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 a ref is remounted, for example inside a <Show>, the on_load handler panics. The issue appears to be that on_load uses Cell.take() in the render effect, so the closure is no longer available when the ref is remounted.
panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos_dom-0.6.11/src/node_ref.rs:172:26:
called `Option::unwrap()` on a `None` value
The NodeRef also logs a warning when remounting refs:
You are setting a NodeRef that has already been filled. It’s possible this is intentional, but it’s also possible that you’re accidentally using the same NodeRef for multiple _ref attributes.
I think having a ref to a toggable element is a valid use case, but maybe I'm wrong there.
Leptos Dependencies
I first spotted the bug when using 0.6.9, but the CodeSandbox uses this:
leptos = { version = "0.6.11", features = ["csr", "nightly"] }
Expected behavior
I would expect on_load to be called again when the ref is remounted. It would also be nice if the NodeRef warnings could be disabled. For example, by having some way to indicate that a ref is allowed to be remounted.
The text was updated successfully, but these errors were encountered:
Describe the bug
When a ref is remounted, for example inside a
<Show>
, theon_load
handler panics. The issue appears to be thaton_load
usesCell.take()
in the render effect, so the closure is no longer available when the ref is remounted.The
NodeRef
also logs a warning when remounting refs:I think having a ref to a toggable element is a valid use case, but maybe I'm wrong there.
Leptos Dependencies
I first spotted the bug when using
0.6.9
, but the CodeSandbox uses this:To Reproduce
I made a small example in CodeSandbox to reproduce it: https://codesandbox.io/p/devbox/upbeat-johnson-h4mcsc.
In the CodeSandbox:
Expected behavior
I would expect
on_load
to be called again when the ref is remounted. It would also be nice if theNodeRef
warnings could be disabled. For example, by having some way to indicate that a ref is allowed to be remounted.The text was updated successfully, but these errors were encountered: