-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow strings in layout list #2900
Allow strings in layout list #2900
Conversation
dash/_validate.py
Outdated
if isinstance(component, (Component,)): | ||
_validate(component) | ||
else: | ||
raise exceptions.NoLayoutException( | ||
"List of components as layout must be a list of components only." | ||
"List of components as layout must be a list of strings and components only." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"List of components as layout must be a list of strings and components only." | |
"Only strings and components are allowed in a list layout." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified in d9d963f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good just missing a changelog entry.
Added in ba30a4d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 Thank you
No problem @T4rk1n! Thank you for reviewing my changes! 🙏 It seems that one of the tests failed (tests/integration/renderer/test_persistence.py:209 test_rdps005_persisted_props), although these changes shouldn't have influenced it. The test is also passing on my machine. Is this what's blocking the merge? |
Not really blocking, it's probably just a flaky test, I usually merge something else and update the branch see if it passes, if not I will mark it as flaky and then merge. Anyway it's good and will be merged before the next release. |
Ah okay, sounds good. Thanks for the clarification! |
Nice fix! |
Thank you @ndrezn! 🙏 |
Think there is something wrong with the CI image/container because that test fails consistently on Python 3.8 image. I will merge the PR in another branch then in dev just to be sure. |
Fixes #2890.
The problem was that strings were not allowed when the page layout was defined as a list. The issue only happens the first time—and not the second one after a refresh—because the layout validation using
validate_layout()
is only done the first time the page is accessed, resulting in the errordash.exceptions.NoLayoutException: List of components as layout must be a list of components only.
The solution is simply to allow strings to be included when the page layout is a list.
Contributor Checklist
optionals
CHANGELOG.md