Closed jhartma closed 11 months ago
The problem seems to be the Rcuse_context
out of it, it works
Ah this might be something to do with the interaction between async components and reactive context. The error message seems to point out that there is no current_node
set in Root
when we are inside an async scope. I'll have to look more into this.
Oh I just realised are you calling login
in an event handler? If that's the case, this would be expected behaviour. Event handlers are called at the root scope where the context is not defined, thereby causing the error. The way to solve this would be to hoist the use_context
out of the event handler.
Thanks for clarifying this!
In the 0.8.2 version, I used a global state struct that had many methods that needed a handle on the state struct itself, and since context was available everywhere, I pulled in the state via use_context
. But since actions where called by an event handler, I got this error all over the place when updating to 0.9.0-beta.2. Using use_context
only in components and passing the state around solved it finally.
Describe the bug After updating my working app to 0.9.0-beta.2, I get the following runtime error message in the console
This is what causes the error in my code:
Environment