flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.59k stars 454 forks source link

Hot reload not working on flet version 0.24.1 #4034

Open SteveSant26 opened 2 months ago

SteveSant26 commented 2 months ago

Duplicate Check

Describe the bug

I'm trying to use the hot reload feature by running "flet run main.py -d", but everytime i make a change, my app crashes (?), for example in this code, where i just deleted one letter to the word worlddd, it crashed and didnt make the change. image When I use --web, the hot reload does work as expected, but when i run it as a desktop app, it doesnt.

Code sample

Code ```python import flet as ft def main(page: ft.Page): page.title = "CRUD SQLITE" page.window.min_height = 500 page.window.min_width = 500 page.theme_mode = "dark" page.add(ft.Text("Hello Worldd!")) if __name__ == "__main__": ft.app(target=main, view=ft.AppView.FLET_APP) ```

To reproduce

  1. Run the code
  2. Make a change in the code
  3. See it doesnt changes

Expected behavior

I would expect the hot reload to work properly

Screenshots / Videos

Captures [Upload media here]

Operating System

Windows

Operating system details

Windows 11 pro 23H2

Flet version

0.24.1

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs ```console [Paste your logs here] ```

Additional details

No response

ndonkoHenri commented 1 month ago

Reproducible on macOS sequoia.

OwenMcDonnell commented 1 month ago

Not reproducible on Windows 11.

merror-dev commented 1 month ago

I have the same problem, but i discovered a solution, at least it works for me.

I use alt+tab and i noticed if i did it too fast while the fleet loading ring is still running it will go on an infinity loop, but if you wait a bit until the ring disappears it will work. You can alt+tab but dont release the keypress see the window preview until the loading ring disappears then release the keys.

If you dont want to use alt+tab you can split screen (code editor and running flet app) and work as normal, the key here is not to focus flet window while the loading ring is running

tobypeschel commented 4 weeks ago

I have the same issue with 0.24.1 on Windows 11 with flet run <app>.

After making a change, about ~10% of the time it freezes with the loading animation and eventually crashes with high RAM usage. At one point it was happening consistently while doing incredibly basic stuff, like running the counter template or displaying a few lines of text...