mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
desktop: Stop losing and wasting refreshes on events
An update that arrived while a route was still loading was lost, since the loader's result then counted as fresh, so the events now invalidate through the shared helper that marks such fetches stale. A repo arriving or renamed without the update naming its refs left the sidebar list as it was, and updates that changed nothing still dropped the hover caches. A test now checks the frontend's ref update type against the generated one.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { isCobCacheKey, isJobsKey, isRepoInfoKey, keys } from "../src/keys";
|
||||
|
||||
const rid = "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5";
|
||||
const id = "d87dcfe8c2b3200e78b128d9b959cfdf7063fefe";
|
||||
|
||||
describe("key classifiers", () => {
|
||||
test("job lists", () => {
|
||||
expect(isJobsKey(keys.jobs(rid))).toBe(true);
|
||||
expect(isJobsKey(keys.repo(rid))).toBe(false);
|
||||
expect(isJobsKey(keys.issues(rid))).toBe(false);
|
||||
});
|
||||
|
||||
test("repository info", () => {
|
||||
expect(isRepoInfoKey(keys.repoInfo(rid))).toBe(true);
|
||||
expect(isRepoInfoKey(keys.repos())).toBe(false);
|
||||
});
|
||||
|
||||
test("data the COB cache holds", () => {
|
||||
for (const key of [
|
||||
keys.repoInfo(rid),
|
||||
keys.issues(rid),
|
||||
keys.issueList(rid, "open"),
|
||||
keys.issue(rid, id),
|
||||
keys.patches(rid),
|
||||
keys.patch(rid, id),
|
||||
]) {
|
||||
expect(isCobCacheKey(key)).toBe(true);
|
||||
}
|
||||
for (const key of [
|
||||
keys.repo(rid),
|
||||
keys.code(rid),
|
||||
keys.jobs(rid),
|
||||
keys.releases(rid),
|
||||
keys.boards(rid),
|
||||
keys.notifications(),
|
||||
]) {
|
||||
expect(isCobCacheKey(key)).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user