Sibling Nested Suspense Hydration Error
Hello, I am running into an issue that I think might be a bug. It seems that sometimes when there are 2 components with nested <Suspense> elements, the hydration fails. I believe that this is somehow related to #4430 but I am still rather new to Leptos so reasoning about what is going on under the hood and how that issue translates to my specific case is difficult for me. It seems to have something to do with the timing for sure, though. See the README in my repo for my results with different configurations.
Leptos Dependencies
leptos = { version = "0.8.21" }
leptos_axum = { version = "0.8.10", optional = true }
leptos_router = { version = "0.8.16" }To Reproduce Steps to reproduce the behavior:
- Clone the reproduction repository
- Run
cargo leptos watch - Reload the page multiple times in the browser
- Check browser console for hydration mismatch errors
Next Steps
- I will make a PR
- I would like to make a PR, but need help getting started
- I want someone else to take the time to fix this
- This is a low priority for me and is just shared for your information
Additional context Ultimately this arose when I was trying to make components that could load data themselves based on a key. In my main repo I have a component that takes a service area for a company and loads the counties in that area using a OnceResource. Then, that component has a list of child components (inside a suspense which waits for the county to load), each of which take a county and load cities in that county using a OnceResource. Then, inside that component is a suspense that waits for the cities to load and displays them once they do. My reproduction repo follows a similar structure, with the OuterComponent emulating the county-loading component and the InnerComponent emulating the city-loading component. Is this just a bad pattern in general? What would be the idiomatic way to go about this?
Any help with this would be greatly appreciated, thanks!
Source: leptos-rs/leptos