Skip to content

Commit

Permalink
page.go: ability to skip route change event (flet-dev#2039)
Browse files Browse the repository at this point in the history
page.go: ability to skip route change event
  • Loading branch information
xzripper authored and zrr1999 committed Jul 17, 2024
1 parent cba30ea commit b5cbde9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions sdk/python/packages/flet-core/src/flet_core/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,18 +518,20 @@ def __on_page_change_event(self, data):
if name != "i":
self._index[id]._set_attr(name, props[name], dirty=False)

def go(self, route, **kwargs):
def go(self, route, skip_route_change_event=False, **kwargs):
self.route = route if not kwargs else route + self.query.post(kwargs)

self.__on_route_change.get_sync_handler()(
ControlEvent(
target="page",
name="route_change",
data=self.route,
page=self,
control=self,
if not skip_route_change_event:
self.__on_route_change.get_sync_handler()(
ControlEvent(
target="page",
name="route_change",
data=self.route,
page=self,
control=self,
)
)
)

self.update()
self.query() # Update query url (required when using go)

Expand Down

0 comments on commit b5cbde9

Please sign in to comment.