Skip to content

Commit

Permalink
Wait to sync before export
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Jan 18, 2024
1 parent 675af38 commit 2033f1a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/components/Actions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
return toBase64(svgString);
};
const exportImage = (event: Event, exporter: Exporter) => {
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
const exportImage = async (event: Event, exporter: Exporter) => {
let tries = 50;
while (document.querySelector('.outOfSync') && tries > 0) {
await sleep(100);
tries--;
}
if (document.querySelector('.outOfSync')) {
throw new Error('Diagram is out of sync');
}
Expand Down

0 comments on commit 2033f1a

Please sign in to comment.