Skip to content

Commit

Permalink
Await dynamic component instead
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkstpaul committed Jul 4, 2024
1 parent 301e915 commit c576cf5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions frontend_vue/src/components/ModalContentActivatedToken.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<div class="relative">
<component
:is=tokenIcon
<TokenIcon
:title="tokenServices[tokenType].label"
:logo-img-url="tokenServices[tokenType].icon"
class="w-[6rem] pb-16"
Expand Down Expand Up @@ -43,20 +42,16 @@ const props = defineProps<{
defineEmits(['howToUse']);
const dynamicComponent = shallowRef();
const tokenIcon = shallowRef();
const tokenType = props.newTokenResponse.token_type;
async function loadComponent() {
dynamicComponent.value = defineAsyncComponent(
() => import(`@/components/tokens/${tokenType}/ActivatedToken.vue`)
);
tokenIcon.value = defineAsyncComponent(
() => import(`@/components/icons/TokenIcon.vue`)
);
// Wait for the dynamic component to load before firing the confetti
await dynamicComponent.value.__asyncLoader();
// Wait for the token icon to load before firing the confetti
await tokenIcon.value.__asyncLoader();
launchConfetti(tokenType)
}
Expand Down

0 comments on commit c576cf5

Please sign in to comment.