Skip to content
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

Disposing a signal after it is accessed but before it is tracked triggers a panic #741

Open
lukechu10 opened this issue Oct 29, 2024 · 0 comments
Labels
A-reactivity Area: reactivity and state handling C-bug Category: bug, something isn't working

Comments

@lukechu10
Copy link
Member

lukechu10 commented Oct 29, 2024

Minimal reproducible example:

let _ = create_root(move || {
    let a = create_signal(());
    create_effect(move || {
        a.track(); // Track the signal as a dependency of the effect.
        a.dispose(); // Now dispose of the signal.
    }); // The effect is automatically run when it is created. However, it fails to add the signal to the dependency list since it no longer exists.
});

Resulting in this error:

panicked at /home/_/src/sycamore/packages/sycamore-reactive/src/root.rs:298:36:
invalid SlotMap key used

Expected behavior should just be to completely ignore signals that have been disposed before getting tracked.

Related to #739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-reactivity Area: reactivity and state handling C-bug Category: bug, something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant