Skip to content

Conversation

camdecoster
Copy link
Contributor

@camdecoster camdecoster commented Oct 10, 2025

Description

Update config diff check to handle nested arrays.

Closes #7572.

Changes

  • Linting/formatting
  • Update config diff check method to handle nested arrays
  • Move method to helpers file
  • Add tests for method

Testing

  • Be on master
  • Run this mock in plotly.js DevTools:
    {
      "data": [
        {
        "error_x": {
          "array": [100000.0, 100000.0, 100000.0],
          "type": "data",
          "visible": true
        },
        "type": "scatter",
        "x": [1554370371547.085, 1554370471547.085, 1554370571547.085],
        "y": [6, 10, 2]
        }
      ],
      "layout": {
        "xaxis": {
        "type": "date"
        }
      },
      "config": {
        "modeBarButtons": [[]]
      }
    }
  • Be aware that entering the next command will cause an infinite recursive loop, so add a debugger statement in react before you do to avoid crashing your browser/computer
  • Call react from the browser DevTools console with the following command:
    Plotly.react(gd, gd.data, gd.layout, { modeBarButtons: [ [] ] })
    
  • Click the debugger continue button a number of times and note that it just keeps happening
  • Switch to this branch
  • Run through the same process again
  • Click the debugger continue button and note that it only runs through once

Notes

  • The current diff method doesn't handle nested arrays properly, so the diff check will always return true in this case
  • It didn't cause a problem before because the old code ran through react once and that was it. The new code can make a call to react recursively, which is triggered by the above example.
  • It only happens with the modeBarButtons config option because that's the only one that takes a nested array as a value

TODO

  • Add draftlog

@camdecoster camdecoster changed the title Cam/7572/update-config-diff-check fix: Update config diff check method to handle nested arrays Oct 10, 2025
@camdecoster camdecoster marked this pull request as ready for review October 10, 2025 22:50
@camdecoster camdecoster requested a review from emilykl October 10, 2025 22:50
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]: Plotly.react with config that includes modeBarButtons broken in v3.1.1

2 participants