diff options
Diffstat (limited to 'packages/integrations/solid/server.js')
-rw-r--r-- | packages/integrations/solid/server.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/integrations/solid/server.js b/packages/integrations/solid/server.js index 92b614012..2398ec317 100644 --- a/packages/integrations/solid/server.js +++ b/packages/integrations/solid/server.js @@ -1,6 +1,6 @@ import { renderToString, ssr, createComponent } from 'solid-js/web'; -const slotName = str => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase()); +const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase()); function check(Component, props, children) { if (typeof Component !== 'function') return false; @@ -15,14 +15,14 @@ function renderToStaticMarkup(Component, props, { default: children, ...slotted slots[name] = ssr(`<astro-slot name="${name}">${value}</astro-slot>`); } // Note: create newProps to avoid mutating `props` before they are serialized - const newProps = { + const newProps = { ...props, ...slots, // In Solid SSR mode, `ssr` creates the expected structure for `children`. children: children != null ? ssr(`<astro-slot>${children}</astro-slot>`) : children, - } + }; const html = renderToString(() => createComponent(Component, newProps)); - return { html } + return { html }; } export default { |