vike-ripple 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-ripple",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Vike extension for Ripple TS — SSR, streaming, Layout, Head, SEO configs, hooks",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,37 +1,33 @@
1
1
  export { onRenderClient }
2
2
 
3
- import { hydrate } from 'ripple'
4
3
  import { setPageContext } from '../hooks/usePageContext.js'
5
4
  import { setHydrated } from '../hooks/useHydrated.js'
6
5
 
7
- let hydrated = false
8
-
9
6
  const onRenderClient = async (pageContext) => {
7
+ console.log('[vike-ripple] onRenderClient called', {
8
+ isHydration: pageContext.isHydration,
9
+ isFirstRender: 'isFirstRender' in pageContext,
10
+ hasPage: !!pageContext.Page,
11
+ url: pageContext.urlOriginal,
12
+ location: window.location.href,
13
+ })
14
+
10
15
  const { Page } = pageContext
11
16
  if (!Page) return
12
17
 
13
18
  setPageContext(pageContext)
14
19
  const container = document.getElementById('root')
15
- if (!container) return
16
-
17
- // Hydration — only on the very first page load (SSR)
18
- if (pageContext.isHydration && container.innerHTML !== '' && !hydrated) {
19
- try {
20
- hydrate(Page, { target: container, props: {} })
21
- hydrated = true
22
- setHydrated()
23
- return
24
- } catch (err) {
25
- console.warn('[vike-ripple] hydrate failed, falling back to mount:', err)
26
- }
20
+ if (!container) {
21
+ console.warn('[vike-ripple] no #root container')
22
+ return
27
23
  }
28
24
 
29
- // Mount initial load (if hydrate failed) AND HMR / client navigation
25
+ console.log('[vike-ripple] container child count before:', container.childElementCount)
26
+
27
+ // Just mount — mount() clears container (target.textContent = '') and renders
30
28
  const { mount } = await import('ripple')
31
- // Clear container before mount to prevent duplicate content
32
- // (during HMR the old content is still in the DOM)
33
- if (!pageContext.isHydration) container.innerHTML = ''
34
29
  mount(Page, { target: container, props: {} })
35
- hydrated = true
36
30
  setHydrated()
31
+
32
+ console.log('[vike-ripple] container child count after:', container.childElementCount)
37
33
  }