Skip to content

Commit

Permalink
fix(rendering): prevent removal of necessary <astro-slot> elements
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy committed Mar 4, 2024
1 parent d1700cf commit e713ce0
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions packages/astro/src/runtime/server/render/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ function isHTMLComponent(Component: unknown) {
return Component && (Component as any)['astro:html'] === true;
}

const ASTRO_SLOT_EXP = /<\/?astro-slot\b[^>]*>/g;
const ASTRO_STATIC_SLOT_EXP = /<\/?astro-static-slot\b[^>]*>/g;
function removeStaticAstroSlot(html: string, supportsAstroStaticSlot: boolean) {
const exp = supportsAstroStaticSlot ? ASTRO_STATIC_SLOT_EXP : ASTRO_SLOT_EXP;
return html.replace(exp, '');
}

async function renderFrameworkComponent(
result: SSRResult,
displayName: string,
Expand Down Expand Up @@ -309,9 +302,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
destination.write(html);
} else if (html && html.length > 0) {
destination.write(
markHTMLString(
removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot ?? false)
)
markHTMLString(html)
);
}
},
Expand Down Expand Up @@ -391,7 +382,9 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
})
);
}
destination.write(markHTMLString(renderElement('astro-island', island, false)));
const element = markHTMLString(renderElement('astro-island', island, false));
debugger;
destination.write(element);
},
};
}
Expand Down

0 comments on commit e713ce0

Please sign in to comment.