Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour when using an Icon within ClientOnly fallback #129

Open
slugcat-dev opened this issue Dec 16, 2023 · 6 comments
Open

Comments

@slugcat-dev
Copy link

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

Copy link
Member

atinux commented Dec 18, 2023

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

@slugcat-dev
Copy link
Author

slugcat-dev commented Dec 18, 2023

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

Copy link
Member

atinux commented Dec 18, 2023

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

@slugcat-dev
Copy link
Author

Already tried that, it doesn't work either

Copy link
Member

atinux commented Dec 18, 2023

Can you create a reproduction with Stackblitz please?

@slugcat-dev
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants