The restore repls logic was kinda buggy, especially when you close/open new windows. For example, we only reset the last open repl in the "CLOSE_CURRENT_WINDOW" event (which is only fired in certain cases by the web app) instead of all close events. Additionally, we weren't handling the change in focused events which handles the case where you may have N windows open and you close one then refocus to another window.
Fixes WS-640
What changed
Fix restore repls logic when window is closed/focused
Test plan
Open desktop app, visit repls, open/close windows, etc
Log that the last open repl is saved according to expecations
Why
The restore repls logic was kinda buggy, especially when you close/open new windows. For example, we only reset the last open repl in the "CLOSE_CURRENT_WINDOW" event (which is only fired in certain cases by the web app) instead of all close events. Additionally, we weren't handling the change in focused events which handles the case where you may have N windows open and you close one then refocus to another window.
Fixes WS-640
What changed
Fix restore repls logic when window is closed/focused
Test plan