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

Empty SVG tags when using renderToString() for the first time #255

Open
MickL opened this issue Sep 13, 2024 · 1 comment
Open

Empty SVG tags when using renderToString() for the first time #255

MickL opened this issue Sep 13, 2024 · 1 comment

Comments

@MickL
Copy link

MickL commented Sep 13, 2024

I render a component including icons (with mode svg) to html code to be shown in eBay descriptions:

import { renderToString } from '@vue/server-renderer';
import { MyComponent } from '#components';

onMounted(async () => {
  await renderToString(
    h(MyComponent, {
      prop1: 'hello',
    }),
  );
})

Since I updated to 1.4.x the icons are not working anymore. The svg tags are just empty.

I tried out a lot and found out that the svg tags are just empty on first call of renderToString(). But they are visible when one of this conditions is true:

  • When changing something on the page and Nuxt is refreshing (without refreshing the browser window)
  • If I call it twice with a little delay between the icons are working correctly
  • If I have the same icon visible on the page already
@MickL MickL changed the title [Vue warn]: Component NuxtIcon is missing template or render function. BUG: Component NuxtIcon is missing template or render function. Oct 5, 2024
@MickL MickL changed the title BUG: Component NuxtIcon is missing template or render function. Empty SVG tags: Component NuxtIcon is missing template or render function Oct 5, 2024
@MickL MickL changed the title Empty SVG tags: Component NuxtIcon is missing template or render function Empty SVG tags when using renderToString() for the first time Oct 9, 2024
@MickL
Copy link
Author

MickL commented Oct 9, 2024

I created a Stackblitz:
https://stackblitz.com/edit/nuxt-starter-qzwpbz?file=app.vue

@antfu Do you have an idea maybe? Must be something related to that the icon is not yet loaded

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

1 participant