fix: address multi-pane review concerns#2443
Conversation
| if (result && typeof result.then === "function") { | ||
| return Promise.resolve(result).finally(restoreContext); |
There was a problem hiding this comment.
Module-level globals remain overridden during async window
When the callback returns a Promise the module-level editor, $container, and touchSelectionController stay pointing at the pane's values until the promise settles. If any synchronous code (event handlers, scheduled timers, etc.) runs in that window and reads those globals, it will see the pane's context rather than the active editor's. This is not a regression from the old try/finally (which restored too early), but it is a latent race that could surface if more async callers are added. A comment here noting the interleaving risk would help future readers.
All three current call sites pass synchronous lambdas, so there is no present breakage — just something worth documenting.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
* feat: add multi pane view * add ability to drag one tab from one pane to other * add vertical pane support and keybinds and bug fixes - added vertical pane creation too - vscode style keybinds - resizing of pane - few bug fixes * fix resize pane empty space * fix: issues and bugs * fixed pane focus lifecycle * fix * fix debounce timer and load related issue * fix * fix the drag snap-back * fix * fix tab cleanup * added cleanup * fix * fixed bunch of issues introduced accidently * remove double doc sync and add Ctrl-touch for multi cursor too * correctly drop at carret * fix and use doc cache instead of direct doc.toString * cleanup * fix untiled.txt close the pane and remove ctrl-touch things * fix: harden multi-pane editor state handling (#2444) * fix: address multi-pane review concerns (#2443) --------- Co-authored-by: Ajit Kumar <me@ajitkumar.dev>
No description provided.