Store theme setting for all a user's sessions
Created by: lrhacker
Issue type
Customer request
Problem description
Currently, the user's theme selection (dark mode, light mode, or auto) is saved in local storage, rather than persisted on the user account in any way. This results in the theme selection being reset when a user switches to a new session (on a new device, in a new browser, or in an incognito/private tab). Since we have received customer feedback that this is a pain point during daily use, it seems worth addressing.
Context
#29462 (closed) Describes some dark mode bugs and includes the customer feedback for this specific concern.
Steps to reproduce
While logged in, select a theme that is different from the system default (for ease of reproducing). Then, open up a different browser or private tab and navigate to the application. You will see that the theme is now reverted to the system default, instead of the theme the that was selected by the user previously.
Additional details
This should, in theory, be as simple as using useTemporarySetting
instead of useLocalStorage
(which is now the recommended method anyway, per this lint rule and the Sourcegraph docs on temporary settings).