Skip to content

Commit

Permalink
Replace sleep with nextTick
Browse files Browse the repository at this point in the history
  • Loading branch information
Arzte committed Sep 22, 2024
1 parent 5f00e63 commit 5bf6f8d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/viewer/modal/BackpackModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,8 @@ const backpackToImage = async () => {
const toastGenerateImage = $toast.info('Generating image...', {
timeout: false,
});
// A hack, the DOM won't update until after the image is generated otherwise
const pause = new Promise((resolve) => setTimeout(resolve, 200));
await pause;
// Wait for the next tick to ensure DOM is updated before getting the element.
await nextTick();

// Set background color for svg to project background color if it exists
const currentBackground = backpackRef.value.style.backgroundColor;
Expand Down

0 comments on commit 5bf6f8d

Please sign in to comment.