Skip to content

SharedStateServer doesn't send update to client after refresh #352

Closed
@brentbaum

Description

@brentbaum

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".

Screen Shot 2021-04-22 at 8 51 47 AM

The first time a user brings up the app everything works as expected. The network tab looks like this.

Screen Shot 2021-04-22 at 8 51 51 AM

After a refresh the app keeps sending events but stops receiving them.

Screen Shot 2021-04-22 at 8 52 07 AM

This behavior is consistent across any components that depend on state. Notably, the user is unable to change the value of inputs.

Server code:

def start_app(dispatch):
    from idom.server.sanic import SharedClientStateServer

    # we use a redux-like dispatch structure to send events to outside the idom event, then update state
    # with a callback stored outside the app. 
    # I've tried removing this particular piece of functionality and the problem persists.
    root = lambda: Panel(dispatch)
    app = SharedClientStateServer(root)
    return app.daemon("0.0.0.0", 3040)

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions