Dash: Functions as layout no longer work (_validate_layout throws error)

Created on 14 Aug 2018  路  6Comments  路  Source: plotly/dash

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.

dash-type-bug

All 6 comments

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

Will have a fix for this soon, this was introduced in 0.22.0 via https://github.com/plotly/dash/pull/294 so you can downgrade to 0.21.1 for now or edit as above.

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

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.

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

Fix for this released in dash==0.26.1 see changelog

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mheydasch picture mheydasch  路  3Comments

ninjakx picture ninjakx  路  3Comments

r-chris picture r-chris  路  3Comments

KyleKing picture KyleKing  路  4Comments

ncdingari picture ncdingari  路  4Comments