Skip to content

Sync scatter data after the first drawing batch - #41

Open
ktz03 wants to merge 1 commit into
koaning:mainfrom
ktz03:fix/scatter-data-sync
Open

ktz03 wants to merge 1 commit into
koaning:mainfrom
ktz03:fix/scatter-data-sync

Conversation

@ktz03

@ktz03 ktz03 commented Oct 18, 2026

Copy link
Copy Markdown

Fixes #40, reported by @Artur-Minorius.

The first drag can draw points without updating widget.data, leaving data_as_pandas empty until a later click. The local drawing array aliases the widget model's array, so appending points changes the model value before model.set can detect a change. Drawing after a Python-side data replacement has the same problem.

Copy the array when initializing local drawing state and when receiving change:data. Pending points then stay local until the batch is published. Rebuild the checked-in JavaScript bundle with the repository's pinned esbuild 0.19.11.

Add real JupyterLab/browser regressions for initially empty data, constructor-provided data, and Python-side data replacement.

Validation on Windows, Python 3.12, JupyterLab 4.6.4, anywidget 0.11.0, ipywidgets 8.1.9 and headless Microsoft Edge:

  • Full test suite: 4 passed. The same tests against unmodified production code give 3 failed, 1 passed; the three failures reproduce missing first-drag updates.
  • Real-kernel checks also cover a subsequent click, reset, drawing after reset, undo, Python-side replacement, and pandas/polars/NumPy export row counts.
  • Deterministic bundle rebuild, JavaScript syntax check, wheel build, installation and the CI import check pass.

Browser tests require pytest-playwright and jupyterlab as described in the test module; runtime dependencies are unchanged. Other notebook hosts, operating systems and Python versions were not tested.

@Artur-Minorius

Copy link
Copy Markdown

Thanks for fix!

Env: Windows, Python 3.13, anywidget 0.11.0 ipywidgets 8.1.9, VS Code Extension Jupyter 2025.9.1 and Jupyter Lab 4.3.5 on Waterfox

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data is missing before second click on widget

2 participants