Merge pull request #8999 from streetwriters/web/fix-export-notes-count

web: show total notes count in export dialog
This commit is contained in:
Abdullah Atta
2025-11-27 09:17:22 +05:00
committed by GitHub
2 changed files with 14 additions and 4 deletions

View File

@@ -92,7 +92,11 @@ export async function exportNotes(
const { createZipStream } = await import("../utils/streams/zip-stream");
const errors: Error[] = [];
const exportStream = new ExportStream(report, (e) => errors.push(e));
const exportStream = new ExportStream(
report,
(e) => errors.push(e),
await notes.count()
);
await fromAsyncIterator(
_exportNotes(notes, { format, unlockVault: Vault.unlockVault })
)

View File

@@ -28,8 +28,13 @@ export class ExportStream extends TransformStream<
> {
progress = 0;
constructor(
report: (progress: { text: string; current?: number }) => void,
handleError: (error: Error) => void
report: (progress: {
text: string;
current?: number;
total?: number;
}) => void,
handleError: (error: Error) => void,
totalItems?: number
) {
super({
transform: async (item, controller) => {
@@ -69,7 +74,8 @@ export class ExportStream extends TransformStream<
controller.enqueue(item);
report({
current: this.progress++,
text: `Exporting note: ${item.path}`
text: `Exporting note: ${item.path}`,
total: totalItems
});
}
}