Replies: 2 comments 5 replies
-
|
In this particular case the issue appears to be solved by using a derived signal ( |
Beta Was this translation helpful? Give feedback.
-
|
Ok, having spent a little more time playing around this, I think the issue is something like this: The Memo and the For component both depend on the A Memo is lazy, so its body calculation won't be run until it is read for the first time. In your case, this means on first loading You navigate to The Memo does not run at all during this render; This means that the order in which the Memo runs relative to the effects changes depending on whether you've previously navigating. There are a couple options that I found that worked without panicking:
<For
each={move || {
ingredient_stats.track();
appdata.ingredients()
}}Note that 2 causes the For loop to run twice when you load (Evaluating the Memo once eagerly without tracking in the For does not fix the issue.) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In this demo, deleting an item from a list on page A works if I visit page A directly, but if I navigate to page B and then back to page A, it crashes. The crash is caused by leptos unexpectedly running a closure that belongs to the deleted item (check the console to convince yourself) and thereby accessing a disposed signal.
Am I correct in imagining the reactive graph to look like this?
If yes, what determines the order of the actions running (which seems to be affected by which page I've navigated to) and how can I ensure the right one runs first?
`main.rs` and `Cargo.toml`
Beta Was this translation helpful? Give feedback.
All reactions