Skip to content

Fix FigureWidget compound array property synchronization (Fixes #5689) - #5714

Open
seshan18 wants to merge 2 commits into
plotly:mainfrom
seshan18:main
Open

Fix FigureWidget compound array property synchronization (Fixes #5689)#5714
seshan18 wants to merge 2 commits into
plotly:mainfrom
seshan18:main

Conversation

@seshan18

Copy link
Copy Markdown

Link to issue
Closes #5689

Description of change
This PR fixes a state synchronization bug in FigureWidget where updating compound array properties (like layout.shapes) from the frontend failed to invalidate the Python-side object cache. The fix explicitly pops array properties from _compound_array_props during _dispatch_change_callbacks, ensuring that fig.layout.shapes is accurately rebuilt from the underlying dictionary without surfacing raw Undefined () singletons.

Testing strategy
Testing changes are not strictly needed as this resolves an internal cache invalidation omission within basedatatypes.py. The standard widget synchronization tests continue to pass and now correctly validate array property states.

Additional information (optional)
To ensure object identities are not broken for standard user scripts (e.g., a user holding a reference to ax = fig.layout.xaxis), the cache invalidation is surgically scoped to only affect _compound_array_props. Compound arrays are inherently immutable tuples in Python, so forcing them to rebuild upon length/element changes natively mirrors Plotly's setitem behavior perfectly.

Guidelines
[x] I have reviewed the pull request guidelines and the Code of Conduct and confirm that this PR follows them.
[x] I have added an entry to the changelog if needed (not required for documentation PRs).

@emilykl emilykl self-assigned this Aug 28, 2026
@robertclaus
robertclaus requested a review from emilykl August 28, 2026 17:28
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.

[BUG]: FigureWidget: layout.shapes not updated after drawing a path in JupyterLab

2 participants