Skip to content

Commit 977b809

Browse files
committed
Merge branch 'feat/on-error' of github.com:plotly/dash into feat/on-error
2 parents 3f00325 + a485b4e commit 977b809

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1313
- [#2898](https://github.com/plotly/dash/pull/2898) Fix error thrown when using non-existent components in callback running keyword. Fixes [#2897](https://github.com/plotly/dash/issues/2897).
1414
- [#2892](https://github.com/plotly/dash/pull/2860) Fix ensures dcc.Dropdown menu maxHeight option works with Datatable. Fixes [#2529](https://github.com/plotly/dash/issues/2529) [#2225](https://github.com/plotly/dash/issues/2225)
1515
- [#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)
16+
- [#2900](https://github.com/plotly/dash/pull/2900) Allow strings in layout list. Fixes [#2890](https://github.com/plotly/dash/issues/2890)
17+
- [#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)
1618

1719
## [2.17.1] - 2024-06-12
1820

dash/_validate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,13 @@ def _validate_id(comp):
439439

440440
if isinstance(layout_value, (list, tuple)):
441441
for component in layout_value:
442+
if isinstance(component, (str,)):
443+
continue
442444
if isinstance(component, (Component,)):
443445
_validate(component)
444446
else:
445447
raise exceptions.NoLayoutException(
446-
"List of components as layout must be a list of components only."
448+
"Only strings and components are allowed in a list layout."
447449
)
448450
else:
449451
_validate(layout_value)

dash/dash.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,9 +1988,9 @@ def delete_resource(resources):
19881988

19891989
def run(
19901990
self,
1991-
host=os.getenv("HOST", "127.0.0.1"),
1992-
port=os.getenv("PORT", "8050"),
1993-
proxy=os.getenv("DASH_PROXY", None),
1991+
host="127.0.0.1",
1992+
port="8050",
1993+
proxy=None,
19941994
debug=None,
19951995
jupyter_mode: JupyterDisplayMode = None,
19961996
jupyter_width="100%",
@@ -2116,6 +2116,12 @@ def run(
21162116
dev_tools_prune_errors,
21172117
)
21182118

2119+
# Evaluate the env variables at runtime
2120+
2121+
host = os.getenv("HOST", host)
2122+
port = os.getenv("PORT", port)
2123+
proxy = os.getenv("DASH_PROXY", proxy)
2124+
21192125
# Verify port value
21202126
try:
21212127
port = int(port)

tests/integration/test_integration.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,8 @@ def test_inin028_layout_as_list(dash_duo):
433433
app = Dash()
434434

435435
app.layout = [
436+
"string1",
437+
"string2",
436438
html.Div("one", id="one"),
437439
html.Div("two", id="two"),
438440
html.Button("direct", id="direct"),
@@ -458,6 +460,9 @@ def on_nested_click(n_clicks):
458460

459461
dash_duo.start_server(app)
460462

463+
dash_duo.wait_for_contains_text("#react-entry-point", "string1")
464+
dash_duo.wait_for_contains_text("#react-entry-point", "string2")
465+
461466
dash_duo.wait_for_text_to_equal("#one", "one")
462467
dash_duo.wait_for_text_to_equal("#two", "two")
463468

0 commit comments

Comments
 (0)