Best practice for navigating after action #2930
Replies: 2 comments 1 reply
-
If I'm understanding correctly it's just a warning and not an error, and everything is working fine? In your case it is basically a false positive: you know that you are setting a signal that has already been disposed and that is fine. (It is because navigating away from the page disposes of the action while the action is still in flight, and then when the action resolves it tries to update its EDIT: It does raise some reasonable questions — For example, does it matter if your action returns successfully or is an error? You have no way of knowing which it is. So I don't think it's a totally useless warning/false positive in that sense. |
Beta Was this translation helpful? Give feedback.
-
If you call get_untracked() instead of get() it should go away
…On Thu, Sep 5, 2024, at 4:37 PM, Steve Pryde wrote:
Well I have it set up so that it only navigates on success, so I think it is a false positive here. That's what I thought but I wanted to check that there wasn't something special about the inner workings of actions that makes this a bad thing to do. Thanks for the clarification. That makes sense regarding the update of its `value` signal.
Is there any way to silence this warning for this use case?
—
Reply to this email directly, view it on GitHub <#2930 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABVBTCJRB5K4TDNPJQZ7HFLZVDTKTAVCNFSM6AAAAABNV4FHOWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANJWGI4TSMA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
If I call
navigate()
from withincreate_action()
I get a warning in the browser console that looks like this:And also this:
The same thing happens if I set the value of a signal which then causes the component containing the
create_action()
to be disposed, so it's not strictly related tonavigate()
.It seems to only happen within
create_action()
. If I instead usespawn_local()
I don't get that warning.Is this a bogus warning in this instance? Or is there something I should be doing instead to avoid the warning?
Beta Was this translation helpful? Give feedback.
All reactions