vike-ripple 0.4.9 → 0.5.0
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
|
@@ -22,6 +22,10 @@ const onRenderClient = async (pageContext) => {
|
|
|
22
22
|
|
|
23
23
|
// ── Build same component tree as SSR ──
|
|
24
24
|
// Apply Layouts (innermost first → outermost last)
|
|
25
|
+
// Children must be tsrx_element(() => Component({})) — NOT tsrx_element(Component).
|
|
26
|
+
// The normal form passes Component as the render function; Ripple's render_tsrx_element
|
|
27
|
+
// calls it with (anchor, block), which Component interprets as props, corrupting block tracking.
|
|
28
|
+
// The () => Component({}) wrapper gives Component the proper props object.
|
|
25
29
|
const Layout = config.Layout ?? config.layout
|
|
26
30
|
const Wrapper = config.Wrapper ?? config.wrapper
|
|
27
31
|
let component = Page
|
|
@@ -30,14 +34,14 @@ const onRenderClient = async (pageContext) => {
|
|
|
30
34
|
for (let i = 0; i < layouts.length; i++) {
|
|
31
35
|
const L = layouts[i]
|
|
32
36
|
const prev = component
|
|
33
|
-
component = (props) => L({ ...props, children: tsrx_element(prev) })
|
|
37
|
+
component = (props) => L({ ...props, children: tsrx_element(() => prev({})) })
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
if (Wrapper) {
|
|
37
41
|
const wrappers = Array.isArray(Wrapper) ? Wrapper : [Wrapper]
|
|
38
42
|
for (const W of wrappers) {
|
|
39
43
|
const prev = component
|
|
40
|
-
component = (props) => W({ ...props, children: tsrx_element(prev) })
|
|
44
|
+
component = (props) => W({ ...props, children: tsrx_element(() => prev({})) })
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
|
|
@@ -48,8 +52,6 @@ const onRenderClient = async (pageContext) => {
|
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
// Always use mount() — hydrate() crashes Ripple's hmr wrapper (hydrate_node is null).
|
|
51
|
-
// mount() clears the container (target.textContent = '') and renders fresh.
|
|
52
|
-
// Ripple SSR is used for content delivery; client side always re-renders.
|
|
53
55
|
const { mount } = await import('ripple')
|
|
54
56
|
dispose = mount(component, { target: container, props: {} })
|
|
55
57
|
setHydrated()
|