Skip to content
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

Early comm messages to widget are lost #803

Closed
iisakkirotko opened this issue Feb 21, 2025 · 0 comments · Fixed by #804
Closed

Early comm messages to widget are lost #803

iisakkirotko opened this issue Feb 21, 2025 · 0 comments · Fixed by #804
Labels
bug Something isn't working

Comments

@iisakkirotko
Copy link
Contributor

iisakkirotko commented Feb 21, 2025

Describe the bug

When, for example, widget traits are changed quickly after the creation of the widget, these updates would not be received by the widget. This happens because the widget model is loaded asynchronously by solid.createResource at

this.#widget_result = solid.createResource(esm, async (update) => {
await safe_cleanup(cleanup, "initialize");
try {
model.off(null, null, INITIALIZE_MARKER);
let widget = await load_widget(update, model.get("_anywidget_id"));

Any comm messages that are sent before load_widget resolves are lost.

Reproduction

Take a look at this PyCafe example. If you open the developer console, you can see that none of the change-triggered console messages are sent.

I also think that plotly/plotly.py#4933 (which was fixed differently in plotly/plotly.py#4956) was ultimately due to this behaviour.

Logs

System Info

System info
System:
    OS: macOS 15.3
    CPU: (10) arm64 Apple M2 Pro
    Memory: 909.98 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
Browsers:
    Chrome: 133.0.6943.127
    Safari: 18.3
    Safari Technology Preview: 18.2
-e file:///Users/iisakki/Code/iisakkirotko/anywidget
jupyter-client==8.6.3
jupyter-core==5.7.2
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter-server==2.15.0
jupyter-server-terminals==0.5.3
jupyterlab==4.3.5
jupyterlab-pygments==0.3.0
jupyterlab-server==2.27.3
jupyterlab-widgets==3.0.13
notebook==7.3.2
notebook-shim==0.2.4

Severity

annoyance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant