-
Notifications
You must be signed in to change notification settings - Fork 595
Closed
Labels
bugSomething isn't workingSomething isn't workingenhancementImprovement/OptimizationImprovement/Optimizationhas reproducible stepsIssue is reproducibleIssue is reproducible
Milestone
Description
Description
while using page.go(skip_route_change_event=True) it should skip page.on_route_change. Instead, event is triggered no matter what, in this code example, while clicking on "Go home" button, it should not do anything, neither print("event route") nor append view.
Code example to reproduce the issue:
import flet as ft
def main(page: ft.Page):
page.title = "Routes Example"
def route_change(route: ft.RouteChangeEvent):
print("event route")
page.views.clear()
page.views.append(
ft.View(
"/",
[
ft.AppBar(title=ft.Text("Flet app"), bgcolor=ft.colors.SURFACE_VARIANT),
ft.ElevatedButton("Visit Store", on_click=lambda _: page.go("/store")),
],
)
)
if page.route == "/store":
page.views.append(
ft.View(
"/store",
[
ft.AppBar(title=ft.Text("Store"), bgcolor=ft.colors.SURFACE_VARIANT),
ft.ElevatedButton("Go Home", on_click=lambda _: page.go("/", skip_route_change_event=True)),
],
)
)
page.update()
def view_pop(view):
page.views.pop()
top_view = page.views[-1]
page.go(top_view.route)
page.on_route_change = route_change
page.on_view_pop = view_pop
page.go(page.route)
ft.app(target=main)Flet version:
Version: 0.21.2
Operating system:
Linux Ubuntu
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementImprovement/OptimizationImprovement/Optimizationhas reproducible stepsIssue is reproducibleIssue is reproducible