You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When hydrating a view rendered with SSR, any interpolated variables will be duplicated at the element-level.
To Reproduce
Steps to reproduce the behavior:
Create a component that interpolates any variable.
Prerender that component with SSR using sycamore::render_to_string().
Inject that string into the <body> of your page with web_sys.
Hydrate the component with sycamore::hydrate().
Observe that the interpolated value is duplicated at the element level (e.g. Hello World!Hello World!).
This can also be observed in Perseus from v0.3.0-beta.22 by creating a page that interpolates a value and then enabling the hydrate feature, which enables Sycamore's hydration (and follows a very similar process to that described above).
Expected behavior
Interpolated values should be removed, recomputed, and rendered without duplication.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Sycamore: v0.7.0
Browser: Firefox 96.0b4
OS: Ubuntu
Additional context
An MRE for this issue is available here. Use trunk serve to run it and observe the issue in a browser.
I assume this is caused by simply not removing the old interpolated values, which I understand would be difficult without knowing exactly what they are. My (perhaps very naive) suggestion would be to identify the smallest number of elements within a component that have interpolated values, and then remove those, recomputing the new values. Alternatively, a more nuanced approach could be taken of isolated interpolated values within strings etc., though this may have a large runtime performance cost (but I'm unfamiliar with this part of the Sycamore codebase, so I honestly have no idea).
The text was updated successfully, but these errors were encountered:
Describe the bug
When hydrating a view rendered with SSR, any interpolated variables will be duplicated at the element-level.
To Reproduce
Steps to reproduce the behavior:
sycamore::render_to_string()
.<body>
of your page withweb_sys
.sycamore::hydrate()
.Hello World!Hello World!
).This can also be observed in Perseus from
v0.3.0-beta.22
by creating a page that interpolates a value and then enabling thehydrate
feature, which enables Sycamore's hydration (and follows a very similar process to that described above).Expected behavior
Interpolated values should be removed, recomputed, and rendered without duplication.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Additional context
An MRE for this issue is available here. Use
trunk serve
to run it and observe the issue in a browser.I assume this is caused by simply not removing the old interpolated values, which I understand would be difficult without knowing exactly what they are. My (perhaps very naive) suggestion would be to identify the smallest number of elements within a component that have interpolated values, and then remove those, recomputing the new values. Alternatively, a more nuanced approach could be taken of isolated interpolated values within strings etc., though this may have a large runtime performance cost (but I'm unfamiliar with this part of the Sycamore codebase, so I honestly have no idea).
The text was updated successfully, but these errors were encountered: