Persistence of theming preferences
See original GitHub issueIs your feature request related to a problem? Please describe. This is not really an issue, but more like a new feature. Today we have 2 options with the storage of theming preferences: session or none. The first one is the default, the second one can be achieved following: https://marmelab.com/react-admin/Store.html#transient-store
But I believe it would be really useful that the theme selected with ToggleThemeButton would not be flushed during a logout. Indeed, like most websites if I set my theme to dark mode then I want it dark next time I go on my website.
Describe the solution you’d like
I dug in the source code but did not find an option to change that myself (PR or existing param).
I don’t know how other localStorage values (such as language) are managed in term of resetting, but I believe a global option in Admin component (such as the existing store
param) or an attribute of the Logout component could do the trick.
The default one could be the session
as it is (although I personally don’t like it), and you would also have none
and browser
(or whatever).
Describe alternatives you’ve considered This cache persistence could also be a param of ToggleThemeButton, but again even if I don’t use the ToggleLanguageButton component I believe there would be to many components needing change (instead of 1 global one). Before using the ToggleThemeButton I was using a custom Settings page exactly as in the demo, so I was setting the localStorage values myself and never resetting it.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
hot fix:
Wow cheers, that works like a charm!!