Skip to content

changed typecheck for list value to use isinstance instead of type #3108

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

Merged
merged 12 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ VERSION.txt
!components/dash-core-components/tests/integration/upload/upload-assets/upft001.csv
!components/dash-table/tests/assets/*.csv
!components/dash-table/tests/selenium/assets/*.csv
app.py
launch.json
19 changes: 10 additions & 9 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,6 @@ def _layout_value(self):

@layout.setter
def layout(self, value):
if isinstance(value, list):
value = html.Div(value)

_validate.validate_layout_type(value)
self._layout_is_function = callable(value)
self._layout = value
Expand Down Expand Up @@ -2277,17 +2274,21 @@ def update(pathname_, search_, **states):

# Set validation_layout
if not self.config.suppress_callback_exceptions:
self.validation_layout = html.Div(
[
page["layout"]() if callable(page["layout"]) else page["layout"]
for page in _pages.PAGE_REGISTRY.values()
]
+ [
layout = self.layout
if not isinstance(layout, list):
layout = [
# pylint: disable=not-callable
self.layout()
if callable(self.layout)
else self.layout
]

self.validation_layout = html.Div(
[
page["layout"]() if callable(page["layout"]) else page["layout"]
for page in _pages.PAGE_REGISTRY.values()
]
+ layout
)
if _ID_CONTENT not in self.validation_layout:
raise Exception("`dash.page_container` not found in the layout")
Expand Down