-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
_pending_writes should be non-None when ChatInterface.send with callback is called before served #6521
Comments
I've also seen these ones when working on the Major-Tom app. |
ChatInterface really should not be running callbacks before the app is fully loaded. |
Seems reasonable though since isn't it the equivalent of: import panel as pn
pn.extension()
def callback(event):
print("Received message:", event.new)
button = pn.widgets.Button(name='Click me')
button.on_click(callback)
button.param.trigger("clicks") # similar to .send()
button.servable() Which outputs:
Do you suggest there should be a queue of callbacks until onload, or explicitly |
It's actually okay, but no, those are not the same. A synchronous function will execute immediately and block, meaning that when the application is initialized the callback (and any side-effects it applies) will already have run. With an async function on the other hand you don't know when the callback runs and in the worst case will execute during or shortly after serialization but before the websocket is loaded at which point you will get In the end though that's fine, I just need to make sure that the events aren't dispatched until the app is fully loaded and the WebSocket is open. There is still a clear failure case though, specifically writing an async callback that runs and modifies some Bokeh model directly will still run into the |
The text was updated successfully, but these errors were encountered: