You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The input field contains the previously entered string.
Additional information
When replacing the app.layout line with one of the two other lines denoted with # works, the bug does not surface (i.e., the entered string is persisted correctly).
Although the documentation of dash.Dash.layout says the layout must be a component or a function returning a component (it doesn't say a list of components is allowed), many examples in the Dash documentation use a list of components, e.g., the Hello World example. dash._validate.validate_layout_type() allows lists:
I don't know much about JavaScript, but in a quick debugging session, layout seemed to be an array instead of an object, therefore skipping the persistence restore process.
The bug also surfaces in much more complicated layouts, i.e., when the input is somewhere deep down. It was pretty hard to find out it was due to the top-level list. Everything else seems to be working when using a list, just the persistence wasn't.
The text was updated successfully, but these errors were encountered:
gvwilson
changed the title
[BUG] Persistence not working when layout is list of components
Persistence not working when layout is list of components
Feb 3, 2025
No, but the bug is where it says in applyPersistence, if anyone want to do it before I get to it, it's just removing the Line 355-357 and adding a loop if layout isArray.
Describe your context
Describe the bug
Input persistence with
persistence=True
is not working when using a list of components as layout.Steps to reproduce
Actual behavior
The input field is empty after reloading.
Expected behavior
The input field contains the previously entered string.
Additional information
app.layout
line with one of the two other lines denoted with# works
, the bug does not surface (i.e., the entered string is persisted correctly).dash.Dash.layout
says the layout must be a component or a function returning a component (it doesn't say a list of components is allowed), many examples in the Dash documentation use a list of components, e.g., the Hello World example.dash._validate.validate_layout_type()
allows lists:dash/dash/_validate.py
Lines 400 to 404 in 7c03187
dash/dash/dash-renderer/src/persistence.js
Lines 354 to 357 in 7c03187
layout
seemed to be an array instead of an object, therefore skipping the persistence restore process.The text was updated successfully, but these errors were encountered: