fix: restore browser windows after tab changes - #7
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3aa96a3d1a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| for placementIndex in placements.indices where matches[placementIndex] == nil { | ||
| guard let matchIndex = bestMatchIndex( | ||
| for: placements[placementIndex], | ||
| candidates: candidates, | ||
| excluding: usedIndices | ||
| ) else { | ||
| continue | ||
| } | ||
|
|
||
| matches[placementIndex] = matchIndex | ||
| usedIndices.insert(matchIndex) |
There was a problem hiding this comment.
Choose identity matches globally before reserving candidates
When an earlier placement has a weak identity match (for example, a shared browser title) with a candidate that exactly matches a later placement's document URL, this placement-ordered loop reserves the candidate before considering the stronger pair. The later placement can then fall through to an unrelated same-index window, causing two windows to be restored to incorrect frames. Select the strongest placement-candidate identity pairs globally before applying the index fallback.
Useful? React with 👍 / 👎.
| displays: displays, | ||
| ignoring: ignoredBundleIdentifiers, | ||
| runtimeSnapshotID: kind == .automatic ? snapshotID : nil | ||
| runtimeSnapshotID: snapshotID |
There was a problem hiding this comment.
Preserve runtime identities for previously captured snapshots
When window recovery is enabled and an automatic snapshot already exists, saving a manual layout now replaces the provider's single retainedSnapshotID/retainedWindows pair with the manual snapshot's data. The still-visible automatic snapshot consequently loses the exact runtime identities it previously retained, so restoring it from the UI after browser metadata and window order change can skip or misplace those windows. Retain identities per snapshot, or otherwise avoid invalidating the existing automatic snapshot when capturing a manual one.
Useful? React with 👍 / 👎.
Summary
Verification