mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
desktop: Refresh the identity view
Proposals and votes show as they arrive. Identity COB updates now refresh only the identity instead of the whole repository.
This commit is contained in:
@@ -5,6 +5,7 @@ import type { Action as PatchAction } from "@bindings/cob/patch/Action";
|
||||
import type { Patch } from "@bindings/cob/patch/Patch";
|
||||
import type { Revision } from "@bindings/cob/patch/Revision";
|
||||
import type { Thread } from "@bindings/cob/thread/Thread";
|
||||
import type { Identity } from "@bindings/identity/Identity";
|
||||
import type { RepoInfo } from "@bindings/repo/RepoInfo";
|
||||
import type { Key } from "@radicle-gui/core/keys";
|
||||
import type { QueryOptions } from "@radicle-gui/ui/lib/query.svelte";
|
||||
@@ -23,7 +24,14 @@ export function repoInfo(rid: string): QueryOptions<RepoInfo> {
|
||||
};
|
||||
}
|
||||
|
||||
// `issue` is null once the issue is deleted.
|
||||
export function identity(rid: string): QueryOptions<Identity> {
|
||||
return {
|
||||
queryKey: keys.identity(rid),
|
||||
queryFn: () => invoke<Identity>("identity_by_repo", { rid }),
|
||||
};
|
||||
}
|
||||
|
||||
// `issue` is undefined once the issue is deleted.
|
||||
export interface IssueDetail {
|
||||
issue: Issue | undefined;
|
||||
activity: Operation<IssueAction>[];
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
import type { Identity } from "@bindings/identity/Identity";
|
||||
import type { RepoInfo } from "@bindings/repo/RepoInfo";
|
||||
|
||||
import { createQuery } from "@radicle-gui/ui/lib/query.svelte";
|
||||
import { slide } from "svelte/transition";
|
||||
|
||||
import { identity as identityQuery } from "@app/lib/cobQueries";
|
||||
import { stateCaption, stateIcon } from "@app/lib/identityState";
|
||||
import { motion } from "@app/lib/motion";
|
||||
import { queryClient } from "@app/lib/query";
|
||||
import type { SidebarData } from "@app/lib/router/definitions";
|
||||
import {
|
||||
absoluteTimestamp,
|
||||
@@ -33,7 +36,12 @@
|
||||
sidebarData: SidebarData;
|
||||
}
|
||||
|
||||
const { repo, identity, sidebarData }: Props = $props();
|
||||
const { repo, identity: loadedIdentity, sidebarData }: Props = $props();
|
||||
|
||||
// Proposals and votes show as they arrive. The route loader already put the
|
||||
// identity in the cache.
|
||||
const query = createQuery(queryClient, () => identityQuery(repo.rid));
|
||||
const identity = $derived(query.current.data ?? loadedIdentity);
|
||||
|
||||
const current = $derived(
|
||||
identity.revisions.find(r => r.id === identity.current),
|
||||
|
||||
@@ -26,7 +26,13 @@ import { markLoading } from "@radicle-gui/ui/lib/query.svelte";
|
||||
|
||||
import type { BoardView } from "@app/lib/board";
|
||||
import { loadView } from "@app/lib/boardView";
|
||||
import { issueDetail, load, patchDetail, repoInfo } from "@app/lib/cobQueries";
|
||||
import {
|
||||
identity as identityQuery,
|
||||
issueDetail,
|
||||
load,
|
||||
patchDetail,
|
||||
repoInfo,
|
||||
} from "@app/lib/cobQueries";
|
||||
import {
|
||||
cachedGetCommitDiff,
|
||||
cachedGetDiffText,
|
||||
@@ -495,9 +501,7 @@ export async function loadIdentity(
|
||||
const [sidebarData, repo, identity] = await Promise.all([
|
||||
loadSidebarData(),
|
||||
load(repoInfo(route.rid)),
|
||||
invoke<Identity>("identity_by_repo", {
|
||||
rid: route.rid,
|
||||
}),
|
||||
load(identityQuery(route.rid)),
|
||||
]);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user