Duplicate Check
Describe the bug
When certain conditions are met simultaneously, the problem described in this Issue will occur, where controls fail to update to the interface in a timely manner, and may trigger exceptions such as "Control must be added to the page first".
Two key conditions have been confirmed:
- The specific call to
fph.PermissionHandler() occurs. It is not yet confirmed whether other services will cause this issue, but fph.PermissionHandler() will cause this issue regardless of how it appears, including but not limited to being assigned to a variable, appearing alone, or as a parameter.
- At the same time, a call to
page.push_route() must be made. It doesn't matter what the route parameter is or whether it actually exists.
The order of the two calls mentioned above is irrelevant.
Code sample
Code
import flet as ft
import flet_permission_handler as fph
class MonitorStack(ft.Stack):
def __init__(self, ref: ft.Ref[MonitorStack] | None = None, visible=True):
super().__init__(ref=ref, expand=True, visible=visible)
self.controls = [
ft.Text("Ready", size=14, color=ft.Colors.WHITE)
]
async def main(page: ft.Page):
await page.push_route("/connect") # can be any route
fph.PermissionHandler()
ms = MonitorStack()
page.overlay.append(ms)
ms.controls[0].value = "Permissions service initialized"
ms.update() # will raise an exception
ft.run(main)
To reproduce
- Run the repro code
- The issue occurs. “Ready” will not show up in time unless you minimize and maximize the window.
Expected behavior
Test text should be displayed promptly.
Screenshots / Videos
Captures
[Upload media here]
Operating System
Windows
Operating system details
Windows 11 (26200.8037)
Flet version
0.82.3.dev7890
Regression
Yes, it used to work in a previous Flet version (please specify the version in additional details)
Suggestions
No response
Logs
Logs
Additional details
This works for 0.82.3.dev7807
Duplicate Check
Describe the bug
When certain conditions are met simultaneously, the problem described in this Issue will occur, where controls fail to update to the interface in a timely manner, and may trigger exceptions such as "Control must be added to the page first".
Two key conditions have been confirmed:
fph.PermissionHandler()occurs. It is not yet confirmed whether other services will cause this issue, butfph.PermissionHandler()will cause this issue regardless of how it appears, including but not limited to being assigned to a variable, appearing alone, or as a parameter.page.push_route()must be made. It doesn't matter what therouteparameter is or whether it actually exists.The order of the two calls mentioned above is irrelevant.
Code sample
Code
To reproduce
Expected behavior
Test text should be displayed promptly.
Screenshots / Videos
Captures
[Upload media here]
Operating System
Windows
Operating system details
Windows 11 (26200.8037)
Flet version
0.82.3.dev7890
Regression
Yes, it used to work in a previous Flet version (please specify the version in additional details)
Suggestions
No response
Logs
Logs
[Paste your logs here]Additional details
This works for 0.82.3.dev7807