353fe09a99e65089da6cd38f1642d5558beebb3d
Closing a modal by clicking the backdrop, Cancel, or × called show_modal.set(false) synchronously inside a wasm-bindgen closure. Leptos immediately unmounts the modal, freeing all its closures while the click handler is still on the call stack, which causes wasm-bindgen to panic with "closure invoked after being dropped". Fix: introduce a close() helper that defers set(false) to the next microtask via spawn_local, so the closure returns to wasm-bindgen before the modal is unmounted. Also switch autofocus from Effect+get() to spawn_local+get_untracked() to avoid subscribing NodeRef as a reactive dependency, which would re-trigger during unmount and risk the same panic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
No description provided
Languages
Rust
86.4%
CSS
12.9%
HTML
0.7%