framesurge / perseus

A state-driven web development framework for Rust with full support for server-side rendering and static generation.
https://framesurge.sh/perseus/en-US
MIT License
2.18k stars 89 forks source link

SSR / Hydration HTML mismatch when rendering view! macro inline condition #202

Closed danielnehrig closed 2 years ago

danielnehrig commented 2 years ago

This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels. The author described their issue as follows:

Perseus and Sycamore hydration html mismatch. With inline view! macro conditional rendering.

The steps to reproduce this issue are as follows:

Given following syntax Perseus is able to render the HTML. But upon wasm / sycamore hydration is throwing a client side error.

view! {cx,
div() {
({ if *state.get() { "Ok" } else { "nope" }})
}
}

A minimum reproducible example is available at <I'll add this soon I promise>.

Tribble internal data dHJpYmJsZS1yZXBvcnRlZCxDLWJ1ZyxBLWh5ZHJhdGlvbg==
arctic-hen7 commented 2 years ago

I think this is a pure Sycamore bug, and should be reported there instead. @lukechu10 isn't this a known bug on your end?

lukechu10 commented 2 years ago

@danielnehrig which version of sycamore are you using? A few hydration bugs were fixed with 0.8.0 as well as one in 0.8.2

danielnehrig commented 2 years ago
perseus = { version = "0.4.0-beta.10", features = [ "hydrate" ] }
sycamore = { version = "^0.8.2", features = ["ssr", "hydrate" ] }
lukechu10 commented 2 years ago

It would be great if you could create an MRE. Otherwise, it's hard to tell what the issue is with just the code you provided.

danielnehrig commented 2 years ago

i don't know what i did but i can not reproduce this anymore i'll have to try around more i think i was trying to access some global mock data with onecell and lazylock and in that combination the problem occurred

danielnehrig commented 2 years ago

i guess i close this for now and reopen when it occurs again