Replies: 5 comments 4 replies
|
Hello @valankar. Let's learn more about NiceGUI internals. On each NiceGUI server, there are
In this case, you are under the second situation. Since a shared state is useless for a form, there are two things you can reasonably do:
|
|
Thanks for the info. Regarding storage, is it really intended to use storage after every character is pressed in a form? It seems excessive just to keep a static page from reloading. Also, why is 3 seconds chosen by default? It seems arbitrary. I get quite a bit of timeouts connecting seemingly due to going over 3 seconds. |
|
I think the modern browsers may suspend an inactive tab, in that case NiceGUI will consider the websocket connection as hung and will recreate it whenever the tab becomes active again. |
|
Using storage for this does not really make sense to me. The problem is not only with forms, it is with any page. If I have a page with many graphs (e.g. Plotly), they unnecessarily reload when I switch tabs for a few seconds. There is really no reason for them to reload like that. If increasing the connection timeout here is suggested solution here, I'll try that. |
|
Having used NiceGUI in production for the past 2 years or so, this is the problem that most bothers me.
Could the local storage solution be built into nicegui that automatically restores all state on reconnect? |
Uh oh!
There was an error while loading. Please reload this page.
First Check
Example Code
Description
When I switch from a NiceGUI app to another tab in the browser, then switch back, the page sometimes reloads. This happens much more frequently on Safari/IOS. Is there some reason the page needs to reload or something that triggers it?
Many times I will be filling in a form on my NiceGUI app, have to switch to another tab/app, then come back, and the page reloads resetting everything I entered in the form.
NiceGUI Version
2.16.1
Python Version
3.12.10
Browser
Safari, Edge
Operating System
Windows
Additional Context
No response
All reactions