diff --git a/CHANGELOG.md b/CHANGELOG.md index 2310ef9376..962c32366a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed - [#2114](https://github.com/plotly/dash/pull/2114) Fix bug [#1978](https://github.com/plotly/dash/issues/1978) where text could not be copied from cells in tables with `cell_selectable=False`. - [#2102](https://github.com/plotly/dash/pull/2102) Fix bug as reported in [dash-labs #113](https://github.com/plotly/dash-labs/issues/113) where files starting with `.` were not excluded when building `dash.page_registry`. +- [#2100](https://github.com/plotly/dash/pull/2100) Fixes bug where module name in for a custom `not_found_404` page is incorrect in the `dash.page_registry` when not using the `pages` folder. - [#2098](https://github.com/plotly/dash/pull/2098) Accept HTTP code 400 as well as 401 for JWT expiry - [#2097](https://github.com/plotly/dash/pull/2097) Fix bug [#2095](https://github.com/plotly/dash/issues/2095) with TypeScript compiler and `React.FC` empty valueDeclaration error & support empty props components. - [#2104](https://github.com/plotly/dash/pull/2104) Fix bug [#2099](https://github.com/plotly/dash/issues/2099) with Dropdown clearing search value when a value is selected. diff --git a/dash/dash.py b/dash/dash.py index 782c38611d..e91fbce46a 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -2044,7 +2044,11 @@ def update(pathname, search): # get layout if page == {}: - module_404 = ".".join([self.pages_folder, "not_found_404"]) + module_404 = ( + ".".join([self.pages_folder, "not_found_404"]) + if self.pages_folder + else "not_found_404" + ) not_found_404 = _pages.PAGE_REGISTRY.get(module_404) if not_found_404: layout = not_found_404["layout"] diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index d2659ac54f..ab88a45b8f 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -389,6 +389,12 @@ def test_inin027_multi_page_without_pages_folder(dash_duo): id="multi_layout2", ) + dash.register_page( + "not_found_404", + layout=html.Div("text for not_found_404", id="text_not_found_404"), + id="not_found_404", + ) + app.layout = html.Div( [ html.Div( @@ -414,4 +420,10 @@ def test_inin027_multi_page_without_pages_folder(dash_duo): dash_duo.wait_for_text_to_equal("#text_" + page["id"], "text for " + page["id"]) assert dash_duo.driver.title == page["title"], "check that page title updates" + # test registration of not_found_404 + assert "not_found_404" in dash.page_registry.keys(), "check custom not_found_404" + + # clean up so this page doesn't affect other tests + del dash.page_registry["not_found_404"] + assert not dash_duo.get_logs()