Repository navigation
Fix iOS workspace-list scroll stutter from live updates #9139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
45b2386
Add frame pacing to the workspace-list scroll probe and a timestamps …
azooz2003-bit b2a6180
Stop live workspace-list updates from re-running the diffable apply a…
azooz2003-bit 5363835
Address review: isolate the DEBUG route probe, per-frame hitch budget…
azooz2003-bit 5875bf6
Address review round 2: in-bucket fixture restamps, weak-key route pr…
azooz2003-bit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
60 changes: 60 additions & 0 deletions
60
...bileShellUI/Sources/CmuxMobileShellUI/WorkspaceListTableCoordinator+ApplyRouteProbe.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #if os(iOS) && DEBUG | ||
| import Foundation | ||
|
|
||
| /// DEBUG-only observation of which route a coordinator's most recent | ||
| /// configuration update took, isolated from the production type per the | ||
| /// source policy on test-only seams (mirrors how | ||
| /// `WorkspaceListScrollMetricsProbe` isolates DEBUG instrumentation). The | ||
| /// coordinator's `#if DEBUG` call sites record here; package tests read the | ||
| /// route back through ``WorkspaceListTableCoordinator/lastPayloadApplyRoute``. | ||
| extension WorkspaceListTableCoordinator { | ||
| /// How one configuration update reached the table. | ||
| enum PayloadApplyRoute: Equatable { | ||
| /// No row renders differently; the table was not touched. | ||
| case noChange | ||
| /// Payload-only changes with stable heights; the visible changed | ||
| /// cells were re-configured in place, listed here by item id. | ||
| case reconfiguredInPlace([String]) | ||
| /// Structure or a row height changed; a snapshot was applied. | ||
| case snapshotApply | ||
| } | ||
|
|
||
| /// The most recent update's route, or nil before the first update. | ||
| var lastPayloadApplyRoute: PayloadApplyRoute? { | ||
| WorkspaceListApplyRouteProbe.lastRoute(for: self) | ||
| } | ||
|
|
||
| func recordPayloadApplyRoute(_ route: PayloadApplyRoute) { | ||
| WorkspaceListApplyRouteProbe.record(route, for: self) | ||
| } | ||
| } | ||
|
|
||
| /// Registry with weak coordinator keys: an entry dies with its coordinator, | ||
| /// so nothing accumulates over a DEBUG session and a new coordinator reusing | ||
| /// a freed address can never read a predecessor's route. | ||
| @MainActor | ||
| private enum WorkspaceListApplyRouteProbe { | ||
| private final class RouteBox { | ||
| let route: WorkspaceListTableCoordinator.PayloadApplyRoute | ||
| init(_ route: WorkspaceListTableCoordinator.PayloadApplyRoute) { | ||
| self.route = route | ||
| } | ||
| } | ||
|
|
||
| private static let lastRoutesByCoordinator = | ||
| NSMapTable<WorkspaceListTableCoordinator, RouteBox>.weakToStrongObjects() | ||
|
|
||
| static func record( | ||
| _ route: WorkspaceListTableCoordinator.PayloadApplyRoute, | ||
| for coordinator: WorkspaceListTableCoordinator | ||
| ) { | ||
| lastRoutesByCoordinator.setObject(RouteBox(route), forKey: coordinator) | ||
| } | ||
|
|
||
| static func lastRoute( | ||
| for coordinator: WorkspaceListTableCoordinator | ||
| ) -> WorkspaceListTableCoordinator.PayloadApplyRoute? { | ||
| lastRoutesByCoordinator.object(forKey: coordinator)?.route | ||
| } | ||
| } | ||
| #endif |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.