Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: React to config changes #7475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
camdecoster merged 8 commits into master from react-to-config-changes
Sep 4, 2025
Merged

fix: React to config changes #7475

camdecoster merged 8 commits into master from react-to-config-changes
Sep 4, 2025

Conversation

Copy link
Contributor

@archmoj archmoj commented Jul 17, 2025
edited by camdecoster
Loading

Description

Use newPlot if config has changed instead of _doPlot inside Plotly.react.

Closes #7551.
Supersedes #6395.

Changes

  • Adds check to determine if newPlot should be used
  • Updates tests per above change

Testing

  • Be on master
  • Launch Plotly DevTools
  • Open mock line_scatter (other mocks could work, but I know this one does)
  • Run the following snippet to update the mode bar buttons:
    let toggle = true
    Plotly.react(
     gd,
     gd.data,
     gd.layout,
     {
     displaylogo: false,
     modeBarButtonsToAdd: [
     {
     name: 'custombutton',
     title: toggle ? 'Take PICTURE' : 'Record MOVIE',
     icon: toggle ? Plotly.Icons.camera : Plotly.Icons.movie,
     click: () => {}
     },
     ],
     modeBarButtonsToRemove: [
     "autoscale",
     "pan2d",
     "lasso2d",
     "resetScale2d",
     "select2d",
     "toImage",
     "zoom",
     "zoomIn2d",
     "zoomOut2d"
     ]
     }
    )
  • Run this other snippet to update the label of the custom button:
    toggle = false
    Plotly.react(
     gd,
     gd.data,
     gd.layout,
     {
     displaylogo: false,
     modeBarButtonsToAdd: [
     {
     name: 'custombutton',
     title: toggle ? 'Take PICTURE' : 'Record MOVIE',
     icon: toggle ? Plotly.Icons.camera : Plotly.Icons.movie,
     click: () => {}
     },
     ],
     modeBarButtonsToRemove: [
     "autoscale",
     "pan2d",
     "lasso2d",
     "resetScale2d",
     "select2d",
     "toImage",
     "zoom",
     "zoomIn2d",
     "zoomOut2d"
     ]
     }
    )
  • Note that the button title and icon have not updated
  • Switch to this branch
  • Reload the mock
  • Run the two snippets again
  • Note that the button title and icon have changed

Notes

@archmoj archmoj self-assigned this Jul 17, 2025
@archmoj archmoj added bug something broken cs customer success P1 needed for current cycle labels Jul 17, 2025
Copy link
Contributor

@camdecoster camdecoster left a comment

Choose a reason for hiding this comment

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

This seems okay, but before I approve could you please provide a description and some steps to reproduce the issue? Then I can test before/after changes and see the fix in action.

Copy link
Contributor

emilykl commented Sep 3, 2025
edited
Loading

(削除) @camdecoster This is intended to address #6394, correct? (削除ここまで)

Never mind, just saw your comment in the PR description. In that case, would it make sense to open another issue which can be closed by this PR?

Copy link
Contributor

@emilykl emilykl left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me.

Call react again to ensure transitions are triggered
Remove obsolete references to configChanged
Copy link
Contributor

(削除) @camdecoster This is intended to address #6394, correct? (削除ここまで)

Never mind, just saw your comment in the PR description. In that case, would it make sense to open another issue which can be closed by this PR?

Yes. I have a comment drafted about that, but never submitted it. 🤦

layout: layout
});
return plotDone.then(() => {
if (!configChanged) gd.emit('plotly_react', { config, data, layout });
Copy link
Contributor

@emilykl emilykl Sep 4, 2025

Choose a reason for hiding this comment

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

@camdecoster Is there a reason we don't want to emit a plotly_react event if the config changed?

Copy link
Contributor

@camdecoster camdecoster Sep 4, 2025

Choose a reason for hiding this comment

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

It will emit twice for one call to react without that check. This is because we call newPlot and then react again after that, all within the first call to react.

emilykl reacted with thumbs up emoji
@camdecoster camdecoster changed the title (削除) React to config changes (削除ここまで) (追記) fix: React to config changes (追記ここまで) Sep 4, 2025
@camdecoster camdecoster merged commit 4f7a513 into master Sep 4, 2025
5 of 6 checks passed
@camdecoster camdecoster deleted the react-to-config-changes branch September 4, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@camdecoster camdecoster camdecoster left review comments

@emilykl emilykl emilykl approved these changes

@alexcjohnson alexcjohnson Awaiting requested review from alexcjohnson

Labels
bug something broken cs customer success P1 needed for current cycle
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Some configuration changes aren't reflected during calls to Plotly.react

AltStyle によって変換されたページ (->オリジナル) /