diff --git a/desktop/src/components/SourceHeader.svelte b/desktop/src/components/SourceHeader.svelte index d5390d787..ad124d5ba 100644 --- a/desktop/src/components/SourceHeader.svelte +++ b/desktop/src/components/SourceHeader.svelte @@ -22,10 +22,21 @@ baseRoute: SourceBaseRoute; active: "files" | "commits"; extra?: Snippet; + // Shown just before the peer selector, about the revision it selects. + notice?: Snippet; } - const { repo, peer, revision, oid, commit, baseRoute, active, extra }: Props = - $props(); + const { + repo, + peer, + revision, + oid, + commit, + baseRoute, + active, + extra, + notice, + }: Props = $props(); // The commit count requires a full history walk on the backend, so it is // fetched after render instead of blocking navigation. The key guard keeps @@ -127,6 +138,10 @@ gap: 2px; margin-left: auto; } + .notice { + display: flex; + margin-right: 0.5rem; + } .commit-summary { color: var(--color-text-secondary); font: var(--txt-body-m-regular); @@ -171,6 +186,9 @@ {/if}
+ {#if notice} + {@render notice()} + {/if} + {/if} + {/snippet} +
{ + markLoading( + queryClient, + keys.headLoaded(route.rid, route.peer, route.revision), + ); const [sidebarData, repo, commit] = await Promise.all([ loadSidebarData(), load(repoInfo(route.rid)), diff --git a/shared/core/src/keys.ts b/shared/core/src/keys.ts index 608c6b5a0..23a1cb83f 100644 --- a/shared/core/src/keys.ts +++ b/shared/core/src/keys.ts @@ -7,6 +7,25 @@ export const keys = { repo: (rid: string) => ["repo", rid] as const, repoInfo: (rid: string) => ["repo", rid, "info"] as const, code: (rid: string) => ["repo", rid, "code"] as const, + // The commit a revision resolves to; no revision means the default branch. + head: (rid: string, peer: string | undefined, revision: string | undefined) => + ["repo", rid, "code", "head", peer ?? "", revision ?? ""] as const, + // When a route last resolved that revision, so that a ref update during the + // load can tell the view to check the head again. + headLoaded: ( + rid: string, + peer: string | undefined, + revision: string | undefined, + ) => + [ + "repo", + rid, + "code", + "head", + peer ?? "", + revision ?? "", + "loaded", + ] as const, issues: (rid: string) => ["repo", rid, "issues"] as const, // One status's list; `status` is the filter as the view names it. issueList: (rid: string, status: string) =>