fix(export): split bulk-export toast across success / partial / all-failed
The Phase 9 bulk export utility had a single success toast that was emitted even when zero of N writes succeeded — "Exported 0 of 5 transcripts to folder/" reading like the user just deliberately exported nothing. Branch on the result count: - 0 of N: error toast pointing at the console for write failures. - N of N: success toast. - M of N: warn toast — partial export, with the same console pointer. Single-file save (`saveTranscriptAsMarkdown`) was already correct: explicit success on save, error on failure, silent on user-cancelled — left untouched. https://claude.ai/code/session_0189xUb6ie6t9qHkzatGZ9Rb
This commit is contained in:
@@ -90,11 +90,24 @@ export async function exportTranscriptsToDir(
|
|||||||
console.error("exportTranscriptsToDir write failed", path, err);
|
console.error("exportTranscriptsToDir write failed", path, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toasts.success(
|
if (written === 0) {
|
||||||
written === items.length
|
// All writes failed — surface as an error instead of "Exported 0
|
||||||
? `Exported ${written} transcript${written === 1 ? "" : "s"} to ${basename(dir)}`
|
// transcripts" success toast which reads like the user just bulk-
|
||||||
: `Exported ${written} of ${items.length} transcripts to ${basename(dir)}`,
|
// exported nothing on purpose.
|
||||||
);
|
toasts.error(
|
||||||
|
"Couldn't export transcripts",
|
||||||
|
`0 of ${items.length} written to ${basename(dir)}. Check the console for details.`,
|
||||||
|
);
|
||||||
|
} else if (written === items.length) {
|
||||||
|
toasts.success(
|
||||||
|
`Exported ${written} transcript${written === 1 ? "" : "s"} to ${basename(dir)}`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
toasts.warn(
|
||||||
|
`Partial export to ${basename(dir)}`,
|
||||||
|
`${written} of ${items.length} transcripts written. Check the console for the failures.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user