Creating the figure with selectedpoints does not register those points to the SelectedData
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 dashbelow
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)
Thanks @Speodark - makes sense, and @archmoj i feel like we may have discussed this or a similar situation at some point?
@alexcjohnson hi!, is there any update about the problem?
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?
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?
is there an update on this?