How to use app.storage.tab #3052
Replies: 5 comments
-
Here is a very very summarized mock-up of my site: @ui.page('/')
def index() -> None:
logic = WebGUI() # all the logic is contained in this big object
in here there is the UI using with ui.elements statements and variables are stored in logic.var1, etc.
ui.run(storage_secret='bbb', binding_refresh_interval=0.3, reconnect_timeout=20.0) |
Beta Was this translation helpful? Give feedback.
-
Hi @aljosahafner, Have you read https://nicegui.io/documentation/storage, in particular this demo? It shows how to bind against tab storage to preserve user content between tab reloads. |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks a lot! So you think I could get away by storing my WebGUI object into the browser tab without major modifications to my code? |
Beta Was this translation helpful? Give feedback.
-
I would rather store the state of the web gui instead of the elements itself. Also, I wonder why you experience so many disconnects. Maybe you have not utilized async/await everywhere? Please read https://github.com/zauberzeug/nicegui/wiki/FAQs#why-is-my-long-running-function-blocking-ui-updates |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks a lot for the answer. I successfully used the following:
|
Beta Was this translation helpful? Give feedback.
-
Question
Hey,
So far I have been ignorant about the storage method, but as my web application grew, the users complain often that the connection is broken and the state of their app goes back to the default. What would be a way to implement
app.storage.tab
? The thing is that I don't really properly understand how to instruct the website to use this option.Thanks in advance for any answers and tips.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions