"Update every" value should be remembered across pages
eksperimental opened this issue · comments
Environment
- Elixir version (elixir -v): 1.11.2
- Phoenix version (mix deps): 1.5.7
- Phoenix LiveView version (mix deps): 0.15.3
- Phoenix Dashboard version (mix deps): 0.4.0
- Operating system: Linux
- Browsers you attempted to reproduce this bug on (the more the merrier): Firefox
Actual behavior
Let' s say I change the "update every" value in HOME, and then I switch to another tab. When I came back to home, the value I originally chose is lost
Expected behavior
To remember it. Either globally for all tabs, Or individually per tab
A pull request for this is welcome, probably a hook that stores the value somewhere.
A pull request for this is welcome, probably a hook that stores the value somewhere.
If you give me some guidance on this maybe I can give it a try :)
We did something similar in Livebook. The idea is that you will pass some parameters on connect:
https://github.com/elixir-nx/livebook/blob/main/assets/js/app.js#L47
And those parameters can be read from the cookie:
And the select dropdown will update the cookie whenever it changes using a Phoenix hook. :)
And in the server you read the current value:
Note we will need to do it per page though (i.e. store the value per page but probably all in the same cookie?).