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:
@@ -1345,15 +1345,23 @@ export function getCachedCheckoutShortstat(cwd: string): CheckoutShortstat | nul
|
|||||||
return shortstatCache.get(getShortstatCacheKey(cwd));
|
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);
|
const cacheKey = getShortstatCacheKey(cwd);
|
||||||
if (shortstatCache.get(cacheKey) !== undefined || shortstatInFlight.has(cacheKey)) {
|
if (shortstatCache.get(cacheKey) !== undefined || shortstatInFlight.has(cacheKey)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getOrLoadCheckoutShortstat(cwd, context).catch(() => {
|
void getOrLoadCheckoutShortstat(cwd, context)
|
||||||
// Non-critical: keep listing path resilient even if git commands fail.
|
.then(() => {
|
||||||
});
|
onComplete?.();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// Non-critical: keep listing path resilient even if git commands fail.
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCheckoutDiff(
|
export async function getCheckoutDiff(
|
||||||
|
|||||||
Reference in New Issue
Block a user