-
-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hydration bug wrt resource-dependent content #3398
Comments
Addendum: The HTML sent by the server looks like this:
^ Note that even though all the |
Just for the sake of clarity, this is not in fact a regression in 0.7.1. If you set the version to 0.7.0, the same error still occurs: leptos = { version = "=0.7.0" } Note also that it requires the two Finally, note that the behavior is the same regardless of SSR mode -- i.e., it breaks on I suppose this is because Am I correct in the hypothesis that, in your actual/non-minimal use case, this happens with two adjacent text nodes in two separate I really do think it's about the adjacent text nodes, though. Here's a much-less-complex #[component]
fn Complex() -> impl IntoView {
let r2 = Resource::new_blocking(|| (), |()| more_complex());
view!(<Suspense>{
move || r2.get().map(|b| view!{
"hello!"
<span/>
})
}</Suspense>)
} |
Unfortunately not :( If I insert I'll do some more investigating and try to get another non-working minimal example going. Thanks for your help so far |
Update: It was not leptos 0.7.1; thaw also got an update, and reverting that from 0.4-rc to 0.4-beta5 makes it go away. It's not entirely clear to me where thaw components are involved at that point, but that probably means the actual problem is much earlier in the DOM. (The spinner I use is actually a copy-paste with modified CSS of the thaw one, so that didn't change). It is of course possible that the problem with thaw 0.4-rc is related to the issue above with consecutive text nodes, but that will take a lot more digging to figure out. Either way, thanks for your efforts; I will leave this issue open in case you want it as a reminder for the consecutive-text-nodes-problem; otherwise feel free to close. |
I’m running into something similar (but I’m not using Thaw, just plain Leptos + tailwind). I’m trying to figure out a minimal reproduction. |
I think my issue is actually slightly different -- I can only reproduce it when using islands. I opened a separate issue with a minimal repro: #3419 |
Describe the bug
If content depends on the result of at least two resources in somewhat non-direct ways, it is possible to get client errors "A hydration error occurred while trying to hydrate an element", where the client seemingly expects the HTML that would be there if both resources have been resolved, but the server sends the fallback for resource 2, with the resolution attached in a
<script>
-node at the end. This seems to be new to v0.7.1.Two cases I have found where this occurs:
Leptos Dependencies
Exactly those of
LEPTOS_CARGO_GENERATE_VERSION=v0.22.0 cargo leptos new --git https://github.com/leptos-rs/start-axum
To Reproduce
replace the
App
andHomePage
components of the start-axum template by the following:Expected behavior
that the client doesn't panic. More precisely: Either that both resources are fully resolved server-side and the resulting HTML is fully resolved, or that the results of the resources are embedded in script nodes in the end and that is what the client expects, or that the HTML contains the fallbacks and the client knows to request the second resource from the server. Probably depending on the Ssr-mode (I'm definitely out of my depth here).
Screenshots
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: