Push-driven checkout diff subscriptions for changes sidebar (#24)

* Implement push-driven checkout diff subscriptions

* Remove legacy checkout diff polling RPC

* Fix checkout diff watcher coverage and fallback refresh
This commit is contained in:
Mohamed Boudra
2026-02-11 14:11:00 +08:00
committed by GitHub
parent 8e5ba622ee
commit a6f60091f2
9 changed files with 1066 additions and 67 deletions
@@ -0,0 +1,21 @@
import type { SubscribeCheckoutDiffResponse } from "@server/shared/messages";
type ParsedDiffFile = SubscribeCheckoutDiffResponse["payload"]["files"][number];
export function compareCheckoutDiffPaths(left: string, right: string): number {
if (left === right) {
return 0;
}
return left < right ? -1 : 1;
}
export function orderCheckoutDiffFiles(
files: ParsedDiffFile[]
): ParsedDiffFile[] {
if (files.length < 2) {
return files;
}
const ordered = [...files];
ordered.sort((a, b) => compareCheckoutDiffPaths(a.path, b.path));
return ordered;
}