Per user or per browser?
If per browser, that is user X needs to remember different settings on different browsers, then cookies could work, but I don’t like them because they are not flexible and they send data back and forth. I like to use local storage, more flexible than cookies. Anvil Extras provides an easy interface for it, here is how I use it: Persist state of form when navigating away from it - #6 by stefano.menci
If per user, that is user X should get the same settings on all browsers, then you can add a “settings” column to the Users table, then use users.get_user()['settings']
.
Calls to the server do not make the page reload. If you use call_s
instead of call
, you don’t even see the spinner. Most of my apps have timers that call the server every few seconds to see if something is changed and update the ui accordingly, and there is no visible effect on the browser.
If you want to store the settings in the Users (or any other) table, I would call a server function to do it every time any setting changes. There may be many reasons why the user doesn’t close the page and the setting is not saved, and it may be too difficult and unreliable.