Skip to content

Preserve consecutive dcc.Graph relayout updates - #4174

Open
FistOfMight wants to merge 2 commits into
plotly:devfrom
FistOfMight:fix/graph-relayout-lost-updates
Open

FistOfMight wants to merge 2 commits into
plotly:devfrom
FistOfMight:fix/graph-relayout-lost-updates

Conversation

@FistOfMight

Copy link
Copy Markdown

Fixes #4172.

Consecutive Plotly.relayout calls can each copy the same stale figure prop before React delivers an update. The second copy drops the first edit, and the ensuing redraw undoes it on screen. For example, setting a y range and then an x range preserves only the x range.

Build each synchronization on the latest pending figure. Track pending figures until React acknowledges them, retaining later writes across an intermediate acknowledgement and clearing pending writes when an external figure replaces them. This preserves existing figure synchronization for Patch without adding an API or changing the layout keys that are copied.

Related: #3882, #4093 and #4102. This fixes lost updates within a batch, independently of uirevision. The Graph source changes in #4102 apply cleanly alongside this patch; combined runtime behavior has not been tested.

Validation:

  • The consecutive-call integration regression fails on the unmodified 4.5.1 bundle and passes after rebuilding with this change. The nested-relayout control also passes.
  • Both integration cases check the rendered ranges and synchronized figure, then replace the figure through a server callback and verify a later relayout keeps the replacement data/layout.
  • Four unit cases cover accumulated edits, unrelated props, intermediate acknowledgements and external figures. Three fail before the fix; all four pass after it.
  • Full DCC Jest suite: 89 passed.
  • Existing Graph basics/responsive files: 36 passed; with the new regression file, 38 browser cases passed.
  • JavaScript lint/format checks and Python test lint/format checks pass.
  • The standalone loss is also reproduced on the published 4.4.1 wheel.

Additional Python unit sweep: 742 passed across the initial run and a follow-up for three files after installing a missing test dependency; six skipped. The unrelated Firefox browser smoke test could not start in this environment, so the full Python unit sweep is not entirely green.

Contributor Checklist

  • Targets dev as a bug fix.
  • Accumulate pending relayout figures and handle acknowledgements/external replacement.
  • Add and run regression tests.
  • Add a changelog entry.

@sonarqubecloud

Copy link
Copy Markdown

@FistOfMight
FistOfMight marked this pull request as ready for review November 23, 2026 14:40
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.

dcc.Graph loses the first of consecutive Plotly.relayout updates

1 participant