Skip to content
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

Config not reactive in some cases #10

Open
cshaa opened this issue Aug 1, 2024 · 3 comments
Open

Config not reactive in some cases #10

cshaa opened this issue Aug 1, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@cshaa
Copy link
Owner

cshaa commented Aug 1, 2024

Steps to reproduce

  1. Go to https://svelte-plotly-5lon9xrrn-m93as-projects.vercel.app/
  2. Click on “Enable Fullscreen”
  3. See that the button still says “Enable Fullscreen”, not “Disable Fullscreen“

Details

This is caused by plotly#6394Plotly.react ignores some changes in the config:

“Sometimes it works to change config via Plotly.react, sometimes it doesn't.”

Possible walkarounds

  1. Switch from Plotly.react to Plotly.newPlot every time config is updated.
  2. Add { ...element._context } to config. (No idea what this does, see the upstream ticket)
  3. Display and then immediately hide the Plotly logo to trigger a config update, as seen here and here.
@cshaa cshaa added the bug Something isn't working label Aug 1, 2024
@cshaa
Copy link
Owner Author

cshaa commented Aug 1, 2024

Observation: This bug only seems to apply to deep changes in config.modeBarButtonsToAdd (see the original Steps to reproduce) and config.modeBarButtons (see Steps to reproduce #​2, below).

Steps to reproduce #​2

  1. Go to https://svelte-plotly-era6xgkqo-m93as-projects.vercel.app/
  2. Click on “Add custom button”
  3. Click on “Rename first custom button”
  4. See that it's still called “Foobar #​0”

@cshaa cshaa closed this as completed in 400b95c Aug 1, 2024
@cshaa
Copy link
Owner Author

cshaa commented Aug 3, 2024

Fixed by introducing the configReactivityStrategy prop which can take either 'none' or 'static-plot' as values, 'static-plot' being the default. Setting the prop to 'none' disables the walkaround. Setting it to 'static-plot' briefly disables plot interactivity after every config change – this forces the modbar buttons to refresh.

This change is released in 1.0.0

@cshaa
Copy link
Owner Author

cshaa commented Oct 22, 2024

As per @Quacken8's report, the 'static-plot' strategy breaks interactivity in pie charts.

  • Reproduce the issue
  • Short term solution: default to 'none' for pie charts
  • Long term solution: find a walkaround that works for all types of charts.

@cshaa cshaa reopened this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant