Skip to content

Commit

Permalink
* Fixed merge bug which removed the client's single_page_router refer…
Browse files Browse the repository at this point in the history
…ence

* Caught the case when navigating from a non-SPA page to an SPA page in client.open
  • Loading branch information
Alyxion committed Oct 21, 2024
1 parent a24935f commit 7f4b4cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nicegui/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(self, page: page, *, request: Optional[Request]) -> None:
self._body_html = ''

self.page = page
self.single_page_router: Optional[SinglePageRouter] = None
self.storage = ObservableDict()

self.connect_handlers: List[Union[Callable[..., Any], Awaitable]] = []
Expand Down Expand Up @@ -226,8 +227,7 @@ def open(self, target: Union[Callable[..., Any], str], new_tab: bool = False) ->
path = target if isinstance(target, str) else self.page_routes[target]
for outlet in self.top_level_outlets.values():
outlet_target = outlet.resolve_target(path)
if outlet_target.valid:
assert context.client.single_page_router
if outlet_target.valid and context.client.single_page_router is not None:
context.client.single_page_router.navigate_to(path)
return
self.outbox.enqueue_message('open', {'path': path, 'new_tab': new_tab}, self.id)
Expand Down

0 comments on commit 7f4b4cd

Please sign in to comment.