Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Textarea Persistence

I noticed some odd behavior with the dcc Textarea component regarding persistence. Specifically, when I use a callback to set the value property, the value is not persisted.

For some context, I’m trying to find a way to persist the setting of a bootstrap “Collapse” component which does not have its own persistence property. My thought was to use a hidden text area (which does have persistence) to store the state of the collapse component as a string. So when the user clicks a button, the button callback updates the value of the Textarea component, and the Textarea component modifies the is_open property of the Collapse component. What I’ve found is that the Textarea component always reverts to the default value on reload, even with persistence set to True. When I make the Textarea visible and manual edit it (by typing text), the user entered text is persisted.

Is this expected behavior? It seems odd to me that the Textarea’s value property respects persistence for user input but not when set by a callback. If this is expected behavior, does anyone have any suggestions for how to work around the bootstrap Collapse component’s lack of a persistence property?

Thanks in advance