Skip to content

Commit

Permalink
prevent download after cancel
Browse files Browse the repository at this point in the history
fix collapse on download button click
  • Loading branch information
duranb committed Jul 8, 2024
1 parent 1a986e0 commit ec24e40
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/components/plan/PlanForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,14 @@
}),
);
const planDownload: PlanTransfer = getPlanForTransfer(plan, qualifiedActivityDirectives);
const a = document.createElement('a');
a.href = URL.createObjectURL(new Blob([JSON.stringify(planDownload, null, 2)], { type: 'application/json' }));
a.download = planDownload.name;
a.click();
if (!planDownloadAbortController.signal.aborted) {
const planDownload: PlanTransfer = getPlanForTransfer(plan, qualifiedActivityDirectives);
const a = document.createElement('a');
a.href = URL.createObjectURL(new Blob([JSON.stringify(planDownload, null, 2)], { type: 'application/json' }));
a.download = planDownload.name;
a.click();
}
planDownloadProgress = null;
}
}
Expand All @@ -215,7 +216,7 @@
<svelte:fragment slot="right">
<button
class="st-button icon download"
on:click={onPlanDownload}
on:click|stopPropagation={onPlanDownload}
use:tooltip={{ content: planDownloadProgress === null ? 'Download Plan JSON' : 'Cancel Plan Download' }}
>
{#if planDownloadProgress !== null}
Expand Down

0 comments on commit ec24e40

Please sign in to comment.