Skip to content

Commit f8ae468

Browse files
authored
fix: handle undefined link/style in server component response (#368)
1 parent 268447f commit f8ae468

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/server/og-image/satori/transforms/inlineCss.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export async function applyInlineCss(ctx: OgImageRenderEventContext, island: Nux
99
let html = island.html
1010
// inline styles from the island
1111
// empty.mjs returns an __unenv__ object as true
12-
let css = island.head.style.map(s => s.innerHTML).filter(Boolean).join('\n')
12+
let css = island.head.style?.map(s => s.innerHTML).filter(Boolean).join('\n') || ''
1313
// TODO this has an island bug in that it's rendering styles for components that aren't used because they're used in app.vue
1414
// TODO need to make an upstream issue
15-
const componentInlineStyles = island.head.link.filter(l => l.href.startsWith('/_nuxt/components') && l.href.replaceAll('/', '').includes(ctx.options.component))
15+
const componentInlineStyles = island.head.link?.filter(l => l.href.startsWith('/_nuxt/components') && l.href.replaceAll('/', '').includes(ctx.options.component)) || []
1616
// stricter opt-in for runtime
1717
if (!import.meta.prerender && !componentInlineStyles.length) {
1818
return false

0 commit comments

Comments
 (0)