mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
desktop: Refresh the cache after the user's own writes
Reviews and writes with announcing off or the node stopped never reach the node's events, so each write command now invalidates the data it changes, also when it fails partway. Views that pin data join that refetch instead of starting another.
This commit is contained in:
@@ -35,6 +35,7 @@ export const keys = {
|
||||
patchList: (rid: string, status: string) =>
|
||||
["repo", rid, "patches", status] as const,
|
||||
patch: (rid: string, id: string) => ["repo", rid, "patch", id] as const,
|
||||
patchDetails: (rid: string) => ["repo", rid, "patch"] as const,
|
||||
releases: (rid: string) => ["repo", rid, "releases"] as const,
|
||||
boards: (rid: string) => ["repo", rid, "boards"] as const,
|
||||
jobs: (rid: string) => ["repo", rid, "jobs"] as const,
|
||||
|
||||
@@ -9,12 +9,22 @@ export interface RefUpdate {
|
||||
refs?: string[];
|
||||
}
|
||||
|
||||
const ISSUE = "xyz.radicle.issue";
|
||||
const PATCH = "xyz.radicle.patch";
|
||||
const JOB = "xyz.radworks.job";
|
||||
// Releases are artifact COBs.
|
||||
const RELEASE = "dev.radicle.artifact";
|
||||
const BOARD = "works.monadic.board";
|
||||
// The type names of the COBs whose data has keys of its own.
|
||||
export const cobTypes = {
|
||||
issue: "xyz.radicle.issue",
|
||||
patch: "xyz.radicle.patch",
|
||||
job: "xyz.radworks.job",
|
||||
// Releases are artifact COBs.
|
||||
release: "dev.radicle.artifact",
|
||||
board: "works.monadic.board",
|
||||
} as const;
|
||||
const {
|
||||
issue: ISSUE,
|
||||
patch: PATCH,
|
||||
job: JOB,
|
||||
release: RELEASE,
|
||||
board: BOARD,
|
||||
} = cobTypes;
|
||||
|
||||
export function affectedKeys({ rid, refs }: RefUpdate): Key[] {
|
||||
if (refs === undefined) {
|
||||
|
||||
@@ -68,4 +68,22 @@ describe("affectedKeys", () => {
|
||||
}),
|
||||
).toEqual([keys.repo(rid)]);
|
||||
});
|
||||
|
||||
test("signed refs alone affect nothing", () => {
|
||||
expect(
|
||||
affectedKeys({
|
||||
rid,
|
||||
refs: [`refs/namespaces/${nid}/refs/rad/sigrefs`],
|
||||
}),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
test("an unknown COB type affects the whole repository", () => {
|
||||
expect(
|
||||
affectedKeys({
|
||||
rid,
|
||||
refs: [`refs/namespaces/${nid}/refs/cobs/org.example.thing/${issue}`],
|
||||
}),
|
||||
).toEqual([keys.repo(rid)]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user