chore: improve app setup call
This commit is contained in:
parent
9cd6a6657b
commit
ee5d84a665
2 changed files with 6 additions and 2 deletions
|
@ -24,7 +24,9 @@ export default (element) =>
|
|||
const isHydrate = client !== 'only';
|
||||
const boostrap = isHydrate ? createSSRApp : createApp;
|
||||
const app = boostrap({ name, render: () => content });
|
||||
await setup(app);
|
||||
if (typeof setup === 'function') {
|
||||
await setup(app);
|
||||
}
|
||||
app.mount(element, isHydrate);
|
||||
|
||||
element.addEventListener('astro:unmount', () => app.unmount(), { once: true });
|
||||
|
|
|
@ -19,7 +19,9 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) {
|
|||
});
|
||||
}
|
||||
const app = createSSRApp({ render: () => h(Component, props, slots) });
|
||||
await setup(app);
|
||||
if (typeof setup === 'function') {
|
||||
await setup(app);
|
||||
}
|
||||
const html = await renderToString(app);
|
||||
return { html };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue