fix: emit workspace update after shortstat cache warm

Add onComplete callback to warmCheckoutShortstatInBackground so session
can push a workspace_update once diff stats resolve.
This commit is contained in:
Mohamed Boudra
2026-04-06 08:35:02 +07:00
parent 8d4d445c85
commit 93b2199c56
+12 -4
View File
@@ -1345,15 +1345,23 @@ export function getCachedCheckoutShortstat(cwd: string): CheckoutShortstat | nul
return shortstatCache.get(getShortstatCacheKey(cwd));
}
export function warmCheckoutShortstatInBackground(cwd: string, context?: CheckoutContext): void {
export function warmCheckoutShortstatInBackground(
cwd: string,
context?: CheckoutContext,
onComplete?: () => void,
): void {
const cacheKey = getShortstatCacheKey(cwd);
if (shortstatCache.get(cacheKey) !== undefined || shortstatInFlight.has(cacheKey)) {
return;
}
void getOrLoadCheckoutShortstat(cwd, context).catch(() => {
// Non-critical: keep listing path resilient even if git commands fail.
});
void getOrLoadCheckoutShortstat(cwd, context)
.then(() => {
onComplete?.();
})
.catch(() => {
// Non-critical: keep listing path resilient even if git commands fail.
});
}
export async function getCheckoutDiff(