icon icon indicating copy to clipboard operation
icon copied to clipboard

Unexpected behaviour when using an Icon within ClientOnly fallback

Open slugcat-dev opened this issue 1 year ago • 6 comments

Consider following code for your app:

<style>
.loading {
  font-size: 2rem;
}
</style>

<template>
  <ClientOnly>
    <template #fallback>
      <div class="loading">
        <Icon name="svg-spinners:ring-resize" />
        Loading
      </div>
    </template>
    <div class="content" ref="someRef">
      This text should NOT be large!
      Remove the <pre>ref="someRef"</pre> from the parent and it works
    </div>
  </ClientOnly>
</template>

Expected behaviour when loading the page: A big loading spinner, and, when everything is done loading, some normal text, like this: image

Instead, you get this: image

When you remove the ref="someRef" from the content div, it works as expected

slugcat-dev avatar Dec 16 '23 09:12 slugcat-dev

Are you sure this is from Nuxt icon directly and not Nuxt itself?

atinux avatar Dec 18 '23 11:12 atinux

Can't tell, but when you remove the Icon from the template, it works

slugcat-dev avatar Dec 18 '23 11:12 slugcat-dev

Could you try with <IconCSS name="svg-spinners:ring-resize" />?

atinux avatar Dec 18 '23 11:12 atinux

Already tried that, it doesn't work either

slugcat-dev avatar Dec 18 '23 11:12 slugcat-dev

Can you create a reproduction with Stackblitz please?

atinux avatar Dec 18 '23 11:12 atinux

https://stackblitz.com/edit/nuxt-icon-playground-ct93e9?file=app.vue

slugcat-dev avatar Dec 18 '23 12:12 slugcat-dev