Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Functions as layout no longer work (_validate_layout throws error) #334

Closed
philipfreude opened this issue Aug 14, 2018 · 6 comments
Closed
Assignees

Comments

@philipfreude
Copy link

philipfreude commented Aug 14, 2018

Hello,

since the _validate_layout method was introduces in dash.py setting functions as layout no longer works, because calling traverse() on an function fails.
Setting a function as layout is necessary to make the app reload the layout on page reload as described in the documentation.

Currently the fastest option is to remove the _validate_layout call in the _setup_server method.

@philipfreude philipfreude changed the title Functions as layout no longer works (_validate_layout throws error) Functions as layout no longer work (_validate_layout throws error) Aug 14, 2018
@rmarren1 rmarren1 self-assigned this Aug 14, 2018
@philipfreude
Copy link
Author

Checking if the layout is a function and then calling it once to validated the returned layout would be an appropriate fix.

@rmarren1
Copy link
Contributor

Will have a fix for this soon, this was introduced in 0.22.0 via #294 so you can downgrade to 0.21.1 for now or edit as above.

@philipfreude
Copy link
Author

philipfreude commented Aug 14, 2018

Actually it was introduced with version 0.24.2 in commit e190768 so 0.24.1 works fine.

@T4rk1n
Copy link
Contributor

T4rk1n commented Aug 14, 2018

Yes, it's from the disallow duplicate ids of 0.24.2.

@rmarren1 Can fix this with self._layout_value().traverse() instead of self.layout.traverse() or taking the self._cached_layout value.

@rmarren1
Copy link
Contributor

Ah right, forgot more was added to validation. Thanks for the detailed report @phifre !

@rmarren1
Copy link
Contributor

Fix for this released in dash==0.26.1 see changelog

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants