diff --git a/CHANGELOG.md b/CHANGELOG.md index cfb27c8d71..c938ea994b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). - [#2896](https://github.com/plotly/dash/pull/2896) The tabIndex parameter of Div can accept number or string type. Fixes [#2891](https://github.com/plotly/dash/issues/2891) - [#2900](https://github.com/plotly/dash/pull/2900) Allow strings in layout list. Fixes [#2890](https://github.com/plotly/dash/issues/2890) - [#2908](https://github.com/plotly/dash/pull/2908) Fix when environment variables are ignored by Dash.run() at runtime. Fixes [#2902](https://github.com/plotly/dash/issues/2902) +- [#2915](https://github.com/plotly/dash/pull/2915) Fix 'AttributeError' when layout is a function that returns a list of components. Fixes [#2905](https://github.com/plotly/dash/issues/2905) ## [2.17.1] - 2024-06-12 diff --git a/dash/dash.py b/dash/dash.py index f499189838..da2c6c611a 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -714,31 +714,9 @@ def layout(self, value): and not self.config.suppress_callback_exceptions ): - def simple_clone(c, children=None): - cls = type(c) - # in Py3 we can use the __init__ signature to reduce to just - # required args and id; in Py2 this doesn't work so we just - # empty out children. - sig = getattr(cls.__init__, "__signature__", None) - props = { - p: getattr(c, p) - for p in c._prop_names # pylint: disable=protected-access - if hasattr(c, p) - and ( - p == "id" or not sig or sig.parameters[p].default == c.REQUIRED - ) - } - if props.get("children", children): - props["children"] = children or [] - return cls(**props) - layout_value = self._layout_value() _validate.validate_layout(value, layout_value) - self.validation_layout = simple_clone( - # pylint: disable=protected-access - layout_value, - [simple_clone(c) for c in layout_value._traverse_ids()], - ) + self.validation_layout = layout_value @property def index_string(self):