Skip to content
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

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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend just avoiding committing these files rather than changing .gitignore; while unlikely we may need these file names in the future.

Copy link
Author

@kenshima4 kenshima4 Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ndrezn will remove them from gitignore and make sure not to commit the files. Thank you.

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