perf(desktop): restore project context during startup (#6939)

## Summary
Project channels previously appeared as ordinary channels until the
community-wide project enumeration completed, delaying the contextual
right rail most noticeably on larger relays.

- Restore the last fully validated, relay-and-identity-scoped project
collection immediately while keeping live relay data authoritative.
- Resolve the active channel's project home through scoped
`#buzz-channel` queries instead of waiting for the complete project
scan.
- Keep snapshots aligned with community removal and relay reconnect
invalidation.

### Related issue
None found.

### Testing
- Pre-push `file-size-check`, `desktop-check`, `desktop-typecheck`, and
`desktop-test`
- Project enumeration, snapshot persistence, and relay invalidation unit
coverage
- Targeted Playwright scenario: project sidebar rows open the home
channel and nest extra channels

No numeric startup benchmark was captured; this draft validates the
cache and scoped-query behavior while leaving timing measurement for
review.

---------

Signed-off-by: Thomas Petersen <thomasp@squareup.com>
This commit is contained in:
thomaspblock
2026-08-27 22:36:26 -04:00
committed by GitHub
parent 350caf1de3
commit 9733863516
27 changed files with 1003 additions and 124 deletions

View File

@@ -18,6 +18,7 @@ import {
addRepositoryToProject,
eventToRepository,
} from "@/features/projects/projectModels";
import { markProjectDataAuthoritative } from "@/features/projects/projectSnapshot";
import { publishProjectOwnerAnnouncement } from "@/shared/api/projectGit";
import { relayClient } from "@/shared/api/relayClient";
import type { RelayEvent } from "@/shared/api/types";
@@ -315,6 +316,7 @@ export function useAddProjectRepositoryMutation() {
mutationFn: (input: AddProjectRepositoryInput) =>
addProjectRepository(input),
onSuccess: ({ previousProjectId, project }) => {
markProjectDataAuthoritative(project, "local-write");
if (previousProjectId !== project.id) {
queryClient.removeQueries({
exact: true,