Dropdown persistence does not work when its value is filled from a callback

I’ve had the same issue as @chander. @adamschroeder I tried running your example but it didn’t seem to fix the issue as far as I could tell?

As far as I can tell from the dash-renderer source, changes to a components props are recorded for persistence purposes when the component calls setProps. This is how components let dash-renderer know that something has changed and that it should trigger the relevant callbacks. But setProps is only called if a component changes its own props, not if it receives props as the result of callback output. I think this would explain the reported behaviour.

If my understanding is correct, it would likely require a change to the implementation of persistence, I don’t think you can make it work just by modifying Python code. Would be interested to hear from some of the Plotly team about whether it would be possible to support this. Could you for example call recordUiEdit for any observers of the component that made the call to setProps? Or would there be performance implications maybe? There are some cool potential applications if it could be made to work other than what’s posted in this thread such as having an alert appear only the first time a user visits a page (dismissed by button click + callback and then persisted).

2 Likes