Repository navigation
Conversation
Since plotly#3882, plotly_relayout syncs the user edit (e.g. a zoomed axis range) into the figure prop, which replots it. plotly.js then sees the edited value as an app-provided one: it no longer matches the pre-edit value stored in _preGUI, so the edit loses its uirevision protection and the next figure from a callback resets the zoom. Before Plotly.react, put back the _preGUI value for every key whose incoming value is the current user value, while uirevision is unchanged. plotly.js keeps the user edit, and Patch updates built on the synced figure (plotly#3810) still keep it too. Fixes plotly#4093
|
|
Closing as a duplicate of #4102, which I missed before opening this one. It fixes the same regression (#4093) more thoroughly: it records the pre-edit value when the edit is synced, so it also covers a One finding from this PR that may help the review of #4102: a test that zooms with |



Fixes #4093.
Since #3882,
plotly_relayoutsyncs user edits (zoomed axis range, ...) into thefigureprop, and that update replots the graph. plotly.js then sees the edited value as an app-provided one: it no longer matches the pre-edit value stored in_fullLayout._preGUI, so the edit loses itsuirevisionprotection and the next figure returned by a callback resets the zoom.The fix, in
plot(): beforePlotly.react, whileuirevisionis unchanged, every_preGUIkey whose incoming value equals the current user value gets its pre-edit value back. plotly.js keeps the user edit as it did before 4.4.1, and Patch updates built on the synced figure (#3810,test_grbs012) still keep it too.The new test zooms with a real mouse drag:
Plotly.relayoutis not recorded in_preGUI, which is whytest_grbs012did not catch the regression. It fails ondev(range back to the full extent) and passes with the fix.Contributor Checklist
dev(fix or chore) ornext(feature, new API, breaking change), see Which branch to target_preGUIvalues of synced user edits beforePlotly.reacttest_grbs012,test_grbs015; eslint, prettier, black, flake8)optionals
CHANGELOG.md