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

Reactive Store panic when set during NodeRef::on_load #3684

Closed
seanaye opened this issue Mar 7, 2025 · 1 comment
Closed

Reactive Store panic when set during NodeRef::on_load #3684

seanaye opened this issue Mar 7, 2025 · 1 comment

Comments

@seanaye
Copy link
Contributor

seanaye commented Mar 7, 2025

Describe the bug
If you try to set the value of a reactive store during a NodeRef::on_load callback, there is a panic

tachys-0.1.7/src/reactive_graph/node_ref.rs:49:26:
called `Option::unwrap()` on a `None` value

Leptos Dependencies

For example:

leptos = { version = "0.7.7", features = ["nightly", "islands"] }
leptos_router = { version = "0.7.7", features = ["nightly"] }
axum = { version = "0.7", optional = true }
console_error_panic_hook = { version = "0.1", optional = true }
leptos_axum = { version = "0.7.7", optional = true }
leptos_meta = { version = "0.7.7" }
reactive_stores = { version = "0.1.7" }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
wasm-bindgen = { version = "=0.2.100", optional = true }

To Reproduce
Steps to reproduce the behavior:

  1. Checkout this repo
  2. cargo leptos watch
  3. open browser console
  4. See error

Expected behavior
No panic should occur, the value in the store should be set

Screenshots

Image
gbj added a commit that referenced this issue Mar 7, 2025
@gbj
Copy link
Collaborator

gbj commented Mar 7, 2025

This one is actually due to NodeRef::on_load only being allowed to run once, but accidentally tracking reactive reads inside it (which .into_iter() on a keyed store subfield does). See #3686.

@gbj gbj closed this as completed in 3164721 Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants