fix(desktop): drop pull-request panes saved before they carried a repository
Problem
Opening a v2 workspace that still had a pull-request pane open from a build before #7823 throws while rendering that pane's header, because the pane's persisted data has no repository name. Panes have no error boundary of their own, so the whole workspace view falls to the content error screen, and it comes back every time that workspace is opened. So far this has only shown up on canary builds. The next stable release ships #7823, so every stable user with a PR pane open when they upgrade would hit it.
Root cause
#7823 changed PullRequestPaneData from { prNumber, projectId? } to { repoFullName, number }. Pane layouts are persisted in the v2WorkspaceLocalState localStorage collection and are read back through sanitizePaneLayout, but that heal only checks layout structure. It passes pane data through unchanged, so a pre-#7823 PR pane reaches usePullRequestPaneDetail, which reads ref.repoFullName.toLowerCase(). That data can't be migrated at read time: the old pane borrowed its repository from the workspace's project, which the renderer only learns later, from the host.
Fix
sanitizePaneLayout, the existing read-time heal for legacy layout shapes, now removes any pull-request pane whose data has no string repoFullName. It uses the panes package's removePaneFromLayout, so a split sibling is promoted, and a tab left with no panes is dropped. activePaneId is repaired when the active pane was the one removed. The person can reopen the PR from the Changes pane or the sidebar as usual.
Panes of other kinds, and PR panes that already use the new shape, are left untouched (there is a negative test for this).
Verification
$ bunx biome check .../dashboardSidebarLocal/schema.ts .../dashboardSidebarLocal/schema.test.ts
Checked 2 files in 10ms. No fixes applied.
$ cd apps/desktop && bun run typecheck
$ tsc --noEmit (no errors)
$ bun test src/renderer/routes/_authenticated/providers src/renderer/components/RendererLayout src/renderer/routes/_authenticated/_dashboard/v2-workspace
437 pass
0 fail
Ran 437 tests across 67 files.
Before the fix, the new drop test failed (42 pass, 1 fail) and the keep test passed. After the fix, both pass.
Refs DESKTOP-1BT
Summary by cubic
Fixes desktop workspaces that crash when reopening a saved pull-request pane from a build before the pane carried repoFullName. The layout heal now drops those legacy panes, promotes the split sibling, and repairs the active pane or tab, so the workspace opens and the PR can be reopened normally. Modern PR panes and other pane kinds are untouched.
Summary by CodeRabbit
- Bug Fixes
- Pull-request panes with invalid repository information are now removed when restoring a sidebar layout. Valid sibling panes are preserved, and the active pane or tab is updated when necessary.