-
-
Notifications
You must be signed in to change notification settings - Fork 324
SharedStateServer doesn't send update to client after refresh #352
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
Comments
Did this issue arise after the latest update? And I'm assuming the |
@rmorshea I've had this issue since 0.22 and haven't tested before that. You got it, the |
Ok, it looks like I'm able to reproduce, so I'll look into that. With that said, ignoring the logged @idom.component
def SyncStateComponent():
state, set_state = idom.hooks.use_state(None)
@idom.hooks.use_effect
def sync_state():
stop_updating = start_updating(set_state)
return stop_updating
return ...
def start_updating(set_state):
"""Start async thread of execution to frequently set state and return callback to stop"""
...
return callback_to_stop_setting_state |
The main purpose of the Unfortunately that information isn't really documented yet. |
One synchronized view is exactly what we're looking for; the The FYI I've had difficulty with use_effect cleanup effects not running on window close / refresh before. I don't have anything reproducible at this point but will submit another issue if it becomes a problem. |
I think I found the problem. Seems related to this issue: #298 |
Ok, got the PR with the fix passing. Will try and release some time this week. |
Fixed by #353 |
I have a simple app with a few buttons. When the user clicks on a button, the text next to the button toggles between "asserted=False" and "asserted=True".
The first time a user brings up the app everything works as expected. The network tab looks like this.
After a refresh the app keeps sending events but stops receiving them.
This behavior is consistent across any components that depend on state. Notably, the user is unable to change the value of inputs.
Server code:
Any ideas on the root cause or a way to mitigate? The PerClientStateServer throws a CannotAccessError due to our rapid state updates, logging
(f"Did not update {component} - resources of {self} are closed")
so it's a no-go (sorry, I've been waiting to file an issue on that one!)Thanks!
The text was updated successfully, but these errors were encountered: