fix(parcel-sync): progress display stuck + numbers jumping during sync

2 bugs:
1. After Magic/base download completes, progress bar stayed stuck at
   77% because exportProgress was never updated to 'done' client-side.
   Fix: set progress to 'Finalizat' + 100% after successful blob download.

2. syncLayer overwrote the export route's weighted percentages (0-100)
   with raw feature counts (50/200), causing progress bar to jump.
   Fix: when isSubStep=true, sync writes phase/note/phaseCurrent/phaseTotal
   but preserves the parent route's downloaded/total weighted values.
This commit is contained in:
AI Assistant
2026-03-07 11:45:52 +02:00
parent 097d010b5d
commit de1e779770
2 changed files with 56 additions and 1 deletions
@@ -579,6 +579,21 @@ export function ParcelSyncModule() {
a.click();
a.remove();
URL.revokeObjectURL(url);
// Mark progress as done after successful download
setExportProgress((prev) =>
prev
? {
...prev,
status: "done",
phase: "Finalizat",
downloaded: prev.total ?? 100,
total: prev.total ?? 100,
message: `Descărcare completă — ${filename}`,
note: undefined,
}
: null,
);
} catch (error) {
const msg = error instanceof Error ? error.message : "Eroare export";
setExportProgress((prev) =>
@@ -863,6 +878,21 @@ export function ParcelSyncModule() {
a.click();
a.remove();
URL.revokeObjectURL(url);
// Mark progress as done after successful download
setExportProgress((prev) =>
prev
? {
...prev,
status: "done",
phase: "Finalizat",
downloaded: prev.total ?? 100,
total: prev.total ?? 100,
message: `Descărcare completă — ${filename}`,
note: undefined,
}
: null,
);
} catch (error) {
const msg = error instanceof Error ? error.message : "Eroare export";
setExportProgress((prev) =>