diff --git a/CHANGELOG.md b/CHANGELOG.md index cd91e4979a..b061046442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Support `marginal_x`/`marginal_y="heatmap"` in `density_heatmap`, drawing a single-row/column heatmap strip in the margin colored by the same `z`/`histfunc` aggregate as the main plot and sharing its color scale [[#5706](https://github.com/plotly/plotly.py/issues/5706)], with thanks to @lucasjamar for the contribution! +### Fixed +- Fix `FigureWidget` state synchronization bug where frontend modifications to array properties (like `layout.shapes`) failed to properly update the Python property cache and occasionally surfaced `Undefined` objects [[#5689](https://github.com/plotly/plotly.py/issues/5689)] + ## [7.0.0] - 2026-08-25 ### Fixed diff --git a/plotly/basedatatypes.py b/plotly/basedatatypes.py index d81ba0950c..121ae52b73 100644 --- a/plotly/basedatatypes.py +++ b/plotly/basedatatypes.py @@ -5458,6 +5458,16 @@ def _dispatch_change_callbacks(self, changed_paths): ------- None """ + # Invalidate cache for changed compound array properties so that they are + # reconstructed from the underlying properties dictionary on the next access. + # We only pop from _compound_array_props because compound arrays are immutable + # tuples that must be rebuilt to reflect added or removed elements. + for path in changed_paths: + if len(path) > 0: + prop = path[0] + if prop in self._compound_array_props: + self._compound_array_props.pop(prop, None) + # Loop over registered callbacks # ------------------------------ for prop_path_tuples, callbacks in self._change_callbacks.items():