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.03k stars 426 forks source link

Client storage requests do not work on web (static) #3783

Open mfxbe opened 1 month ago

mfxbe commented 1 month ago

Duplicate Check

Describe the bug

Attempting to access any of the client storage requests on web clients results in a TimeoutError (see log). I do not think this is the real problem, but I have not been able to find out more details. The example below tries to access it in the main method, but the problem occurs when used anywhere else.
It's not browser specific, it happens in Firefox/Chrome on Debian as well as in Safari on iOS ( also when used as a PWA).

The same code works fine when using flet run or even when using flet run --web. The Linux builds also just work, the others I have not tried yet. (Edit: Android build works flawless as well)

Code sample

Code ```python import flet as ft def main(page: ft.Page): text = ft.Text("Test") page.add(text) res = page.client_storage.contains_key("key") if res == False: text.value = "Key not found" page.update() ft.app(main) ```

To reproduce

  1. Build code sample with flet build web or flet publish
  2. Run the result on a local or external server
  3. Access the URL in a browser

Expected behavior

No error in log and the displayed text should become "Key not found".

Screenshots / Videos

Captures [Upload media here]

Operating System

Linux

Operating system details

Debian sid

Flet version

0.23.2

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs **From browser console:** ```console Loading from existing service worker. [flutter.js:3:660](http://localhost:8000/flutter.js) Service worker already active. [flutter.js:3:908](http://localhost:8000/flutter.js) Injecting Githubissues.
  • Githubissues is a development platform for aggregating issues.