fix(kanban): await plan updates before resolving merge (fixes #243)
Root cause: updatePlans() was fire-and-forget, causing race condition where resolve() returned before files were written. UI refresh would then read old 'human_review' status instead of 'done'. Fix: Await updatePlans() with try/catch to ensure status persists before UI refresh. Non-fatal error handling preserves existing behavior. Fixes #243 Related: #586, #216
This commit is contained in:
@@ -1766,8 +1766,15 @@ export function registerWorktreeHandlers(
|
||||
}
|
||||
};
|
||||
|
||||
// Run async updates without blocking the response
|
||||
updatePlans().catch(err => debug('Background plan update failed:', err));
|
||||
// IMPORTANT: Wait for plan updates to complete before responding (fixes #243)
|
||||
// Previously this was "fire and forget" which caused a race condition:
|
||||
// resolve() would return before files were written, and UI refresh would read old status
|
||||
try {
|
||||
await updatePlans();
|
||||
} catch (err) {
|
||||
debug('Plan update failed:', err);
|
||||
// Non-fatal: UI will still update, but status may not persist across refresh
|
||||
}
|
||||
|
||||
const mainWindow = getMainWindow();
|
||||
if (mainWindow) {
|
||||
|
||||
Reference in New Issue
Block a user