Skip to content

Fix ScatterWidget circle_brush initialization order in AnyWidget runtimes#36

Merged
koaning merged 2 commits intokoaning:mainfrom
RedZapdos123:fix/scatterwidget-circle-brush-init-34
Apr 23, 2026
Merged

Fix ScatterWidget circle_brush initialization order in AnyWidget runtimes#36
koaning merged 2 commits intokoaning:mainfrom
RedZapdos123:fix/scatterwidget-circle-brush-init-34

Conversation

@RedZapdos123
Copy link
Copy Markdown
Contributor

@RedZapdos123 RedZapdos123 commented Apr 22, 2026

Description:

Issue #34 reported a frontend initialization failure in ScatterWidget in non Jupyter AnyWidget runtimes because class button initialization could touch circle_brush before it was initialized.

This PR updates ScatterWidget initialization to avoid referencing circle_brush before declaration in both source and bundled frontend files. The behavior stays the same after initialization, but the widget no longer raises a startup ReferenceError in AnyWidget runtimes.

It also adds a focused regression test for the circle_brush init order.

Closes #34.

Checklist:

  • I reviewed all changes in this PR myself.
  • I added a regression test for this fix.
  • I reproduced the issue on a clean clone.
  • I ran pytest -q.
  • I ran pytest -q tests/test_scatter_widget_init_order.py.

The validation screenshot showing the earlier error is gone:

image

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
Copy link
Copy Markdown
Owner

@koaning koaning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, had a look and I agree this does fix a few things.

@koaning koaning merged commit 76754d6 into koaning:main Apr 23, 2026
3 checks passed
@koaning koaning mentioned this pull request Apr 23, 2026
2 tasks
koaning added a commit that referenced this pull request Apr 23, 2026
* Bump version to 0.5.1

Patch release covering the circle_brush initialization fix (#36) so
non-Jupyter AnyWidget runtimes no longer hit a ReferenceError on render.

* Refresh demo.py marimo metadata

Bumps the __generated_with marker after opening the notebook in a newer
marimo release; no functional changes.
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.

ReferenceError breaks widget initialization in non-Jupyter environments

3 participants