fix(il): preserve Size Map drill state across cross-assembly gd#161
Merged
willibrandon merged 1 commit intoMay 1, 2026
Merged
Conversation
PR #160 fixed the cross-view back tab so Esc lands on Size Map. But the user's position within Size Map was still wiped by ResetViewState during PushAssemblyDirect: TreemapCurrentLevel, TreemapBreadcrumb, TreemapSelectedIndex, TreemapMatchIndex, CachedSizeTree, and the Size Map SearchState all reset to defaults. After Esc twice the user landed at the root level instead of the drilled type they came from. Snapshot the full Size Map navigation state into a new TreemapBackState record on cross-assembly PushIlBackEntry, restore it after PopAssembly in RestoreFromIlBackEntry's cross-assembly branch. CachedSizeTree is snapshotted alongside the breadcrumb so restored SizeNode references stay identity-consistent — the next render skips the lazy ??= rebuild and keeps the user's original navigation graph. Search snapshot uses a new internal SearchState.RestoreFrom helper. Local-gd entries skip the snapshot to avoid retaining the SizeNode graph unnecessarily. Coverage parameterizes the unit test as a Theory across all three external dispatch paths (call/ldsfld/castclass) plus a "drilled to root" identity case, a no-drill no-fabrication regression guard, a local-gd regression guard, and a real-keys UI test asserting the rendered breadcrumb after two Escapes. Fixes #159
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.
Fixes: #159
Follow-on to #160. That PR fixed the cross-view back tab, so Esc from a cross-assembly gd lands on Size Map again — but the user's position within Size Map was still being wiped. PushAssemblyDirect → ResetViewState clears TreemapCurrentLevel, TreemapBreadcrumb, the selection/match indices, CachedSizeTree, and the Size Map SearchState. The IL back entry didn't snapshot any of it, so the second Esc returned the user to the Size Map root instead of the drilled type they came from.
Snapshot the full Size Map navigation state into a new TreemapBackState record on cross-assembly push and restore it on the cross-assembly branch of RestoreFromIlBackEntry after PopAssembly. CachedSizeTree is part of the snapshot so the lazy
??=rebuild on next render is a no-op and SizeNode references stay identity-consistent — drill-up via the restored breadcrumb walks the original object graph end-to-end. Tests use Assert.Same rather than Assert.Equal because SizeNode is a record, and value-equal duplicates would have hidden a "we restored a copy not the original" bug. Local-gd entries skip the snapshot to avoid retaining the tree on the back stack.The state-level test is parameterized across the three external dispatch paths (call / ldsfld / castclass), so NavigateToExternalMethod, ExternalField, and ExternalType all run through the same restore branch. The UI integration test waits for the exact rendered breadcrumb (built from SizeNode.Name, joined with " > ") after two real Esc presses.