Local cache?

What is the recommended way of storing local state between browser refreshes? I see that it's possible to use the cache storage for e.g. check box states between page refreshes, but this seems to be persistent for all users of the app. Is it possible to store browser-specific state (in localStorage, for example), to maintain user-specific UI state between refreshes?
3 Replies
conic7mo ago
I second this current approach asks a user to log in each time or select from a list of sessions from a dropdown
MaartenBreddels7mo ago
https://github.com/widgetti/solara/pull/452 gives a hint how to do this yourself using the session (this is an ID set via a cookie, which should be stable across a page refresh) to store this on the server side. We should be able to make reactive variables that live in this scope btw (instead of the default kernel scope) To be able to use this on the client side, using localStorage or sessionStorage requires some more work from our side if you want this to work smoothly (without extra redraws). If you search the discord, there are some anywidget localstorage examples as well. We could maybe also do an ipyvue one if that makes it easier.
Monty Python
Monty Python7mo ago
<:pull_open:882464248721182842> [widgetti/solara] feat: get_kernel_id and get_session_id for custom storage
If you want to store data in a custom storage, you need to know the kernel_id or session_id to scope. This can be used to implement something similar to reactive variables.