Skip to content

Commit dd30a03

Browse files
committed
only run early 404 exit if it is not an async page builder
1 parent 78bf315 commit dd30a03

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nicegui/elements/sub_pages.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ def _render_page(self, match: RouteMatch) -> bool:
108108
self._render_error(e)
109109
return True
110110

111-
# NOTE: if the full path could not be consumed, the deepest sub pages element must handle the possible 404
112-
if match.remaining_path and not any(isinstance(el, SubPages) for el in self.descendants()):
113-
if asyncio.iscoroutine(result):
114-
result.close()
115-
return False
111+
if not asyncio.iscoroutine(result):
112+
# NOTE: if the full path could not be consumed, the deepest sub pages element must handle the possible 404
113+
if match.remaining_path and not any(isinstance(el, SubPages) for el in self.descendants()):
114+
if asyncio.iscoroutine(result):
115+
result.close()
116+
return False
116117

117118
self._handle_scrolling(match, behavior='instant')
118119
if asyncio.iscoroutine(result):

0 commit comments

Comments
 (0)