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!
No description provided.