fix: update settings in all open windows#1376
Conversation
|
Will give this a more thorough review later.
Nice! Wasn't aware of that event. That makes sense and simplifies things.
This seems fine for now. 👍 |
dsanders11
left a comment
There was a problem hiding this comment.
I'd like to play with this some more when I get the time next week, but dropped some initial review comments.
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
|
Nice work on this @erikian, and thanks for grabbing the issue! |
Here's my stab at #1352. I mostly followed the approach suggested in that issue, except that I'm listening for updates in the settings using the
storageevent instead of using IPC, so we can get the same result for free without touching the main process.Just a consideration: any open windows (except the one in which the setting was changed) updates its
AppStateobject in response to a setting being changed. However, this PR doesn't (directly) change anything related to the UI state. As you can see in the video below, if I have two windows with the Settings modal opened and I make changes in one of them, checkboxes are checked/unchecked in both windows, while text inputs don't change in the other window (unless I close and reopen the Settings modal manually). This is purely a side effect of how the respective components handle their state; if "simultaneous edition" is desired, it will require some changes (maybe just triggering a re-render of the Settings modal on focus, or even changing how the components respond to updates in the global state) that might or might not be part of the scope here, so I decided to check before going any further.2023-06-21_00-06-40.mp4
Fixes #1352.