dash icon indicating copy to clipboard operation
dash copied to clipboard

Creating the figure with selectedpoints does not register those points to the SelectedData

Open Matan-Morduch opened this issue 3 years ago • 6 comments

Thank you so much for helping improve the quality of Dash!

We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.

Describe your context Please provide us your environment, so we can easily reproduce the issue.

python version: 3.8.10

  • replace the result of pip list | grep dash below
dash                 2.7.0
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-renderer        Not installed
dash-table           5.0.0
  • if frontend related, tell us your Browser, Version, and OS

    • OS: Windows 64-bit operating system
    • Browser: Chrome, (pretty sure its the same for every browser its an internal issue)
    • Version: 107.0.5304.88

Describe the bug

When creating a new figure with a preset selectedpoints, The selectedData of the figure doesn't get updated and remains empty.

You can see this bug when running the example from https://dash.plotly.com/interactive-graphing Generic Crossfilter Recipe

First, we get an error when we select data because we check if selectedpoints_local exists, and then if the range exists, the problem is that my guess is in the new versions of dash, selectedData property return a dictionary with {'points':[ ]}, which means it's not empty but the points list is.

if we check if the points list is empty before getting the range, we don't get an error. But because the selectedData of the newly created figure is empty the second it's created the callback is called again with empty selectedData and removes all of our filters.

Expected behavior

I guess the expected behavior would be that the selectedData will be updated based on the data from the newly created figure (which means the points, range, and maybe more stuff I don't know about)

Matan-Morduch avatar Nov 05 '22 17:11 Matan-Morduch

Thanks @Speodark - makes sense, and @archmoj i feel like we may have discussed this or a similar situation at some point?

alexcjohnson avatar Nov 06 '22 02:11 alexcjohnson

@alexcjohnson hi!, is there any update about the problem?

Matan-Morduch avatar Nov 20 '22 15:11 Matan-Morduch

I was also going through the example at https://dash.plotly.com/interactive-graphing and found it was broken - selecting something gives this error:

Traceback (most recent call last):
  File "/Users/cdeil/temp/app/p4_graphics/app3.py", line 74, in callback
    return [get_figure(df, "Col 1", "Col 2", selectedpoints, selection1),
  File "/Users/cdeil/temp/app/p4_graphics/app3.py", line 31, in get_figure
    if selectedpoints_local and selectedpoints_local['range']:
KeyError: 'range'

Are the docs public so that someone like me could fix this?

Or if it's internal could someone from the Dash team please fix this?

cdeil avatar Dec 29 '22 22:12 cdeil

I see: https://github.com/plotly/dash-docs#this-repo-is-now-an-issue-tracker-only :-(

Maybe someone from the Dash team could please fix this broken docs example?

cdeil avatar Jan 03 '23 09:01 cdeil

is there an update on this?

DanoCH-boop avatar Jan 27 '24 10:01 DanoCH-boop