refactor(connections): give each connection its own panes instead of rebuilding on switch - #2116
Merged
Merged
Conversation
…rebuilding on switch
…that already exists
…hat repaints a switch
…y instead of through a global
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2097. One window now hosts every open connection, and switching between them used to tear the whole pane down and rebuild it from the incoming connection's state. That works, but the rebuilt views start from nothing: the grid returns scrolled to the top, the editor loses its cursor and selection, and a sheet the user was half way through filling in is gone.
Each connection now owns its own sidebar, detail and inspector hosting controllers for as long as it is open. A switch shows the ones that belong to the selected connection and hides the rest.
What changed
ConnectionWorkspaceowns aWorkspacePanesholding its three hosting controllers, built once when the connection opens.WorkspacePaneHostis the stable container that sits in eachNSSplitViewItem.NSSplitViewItem.viewControllercannot be reassigned once installed, so the container stays put and swaps its child.sizingOptions = [], which is what keeps tab content from pinning the window's split dividers (roles users #1872).WindowManagersplits intobuildWindow,openStandaloneWindowandopenInNewWindow. Open in New Window was joining the tab group it was supposed to leave, so the connection ended up as a second native tab of the same window; it now leaves the group.ConnectionWorkspaceHandoff, a global used to hand a moving connection to the window being built for it, is gone. The window takes the connection through its initializer.Measured
Click-to-pixels on a switch, over 20 switches on a 4-connection window:
The remaining synchronous cost is the toolbar rebuild (12-24ms) and the sidebar pane (9-18ms). The toolbar is worth its own change and is not in this one.
The speed is a real but modest improvement. The reason to make this change is state preservation: what the user had on screen is still there when they come back to it.
Tests
ConnectionWorkspaceRegistryTests,WindowLifecycleMonitorTests,WindowLifecycleMonitorRegistrationTests,WorkspaceRail*andConnectionCloseActionTestspass. UI coverage isConnectionCloseUITestsandSingleWindowMenuContractUITests, both landed with #2097. There is no UI test for the strip's contextual menu.