You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have multiple windows open, updating a setting in one window is not reflected in the other windows. Came across this when I updated my GitHub PAT in one window and it wasn't used in the others.
Most visible repro case would be to change the theme in one window and observe that other windows remain on the previous theme.
Suggested plan of attack based off of some brief consideration (alternatives welcome):
Add an enum SettingKey to src/interfaces.ts which lists all keys used to store settings in localStorage
Update all usages of localStorage.getItem/localStorage.setItem to use those enum values
In AppState.save, send an IPC event to main process, e.g. window.ElectronFiddle.settingsChanged()
In main process, listen for that IPC event, then broadcast a "refresh-settings" event to all windows except the sender
In AppState constructor, listen for that event (window.ElectronFiddle.addEventListener('refresh-settings', ...)) and loop through the enum keys, with a switch statement for key values and retrieve the latest value from localStorage and update the state accordingly for that setting
That should ensure exhaustiveness checking for the persisted settings to ensure we don't miss any during future changes.
The text was updated successfully, but these errors were encountered:
If you have multiple windows open, updating a setting in one window is not reflected in the other windows. Came across this when I updated my GitHub PAT in one window and it wasn't used in the others.
Most visible repro case would be to change the theme in one window and observe that other windows remain on the previous theme.
Suggested plan of attack based off of some brief consideration (alternatives welcome):
enum SettingKey
tosrc/interfaces.ts
which lists all keys used to store settings inlocalStorage
localStorage.getItem
/localStorage.setItem
to use those enum valuesAppState.save
, send an IPC event to main process, e.g.window.ElectronFiddle.settingsChanged()
AppState
constructor, listen for that event (window.ElectronFiddle.addEventListener('refresh-settings', ...)
) and loop through the enum keys, with a switch statement for key values and retrieve the latest value fromlocalStorage
and update the state accordingly for that settingThat should ensure exhaustiveness checking for the persisted settings to ensure we don't miss any during future changes.
The text was updated successfully, but these errors were encountered: