chore: initialise strings within spa template

This commit is contained in:
Daniel Roe 2024-11-27 14:02:27 +00:00
parent e1c89beb56
commit aa830c5274
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -146,6 +146,8 @@ const getSPARenderer = lazyCachedFunction(async () => {
const spaTemplate = await import('#spa-template').then(r => r.template).catch(() => '') const spaTemplate = await import('#spa-template').then(r => r.template).catch(() => '')
.then((r) => { .then((r) => {
if (spaPreloaderOutside) { if (spaPreloaderOutside) {
const APP_SPA_LOADER_OPEN_TAG = `<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>`
const APP_SPA_LOADER_CLOSE_TAG = `</${appSpaLoaderTag}>`
const appTemplate = APP_ROOT_OPEN_TAG + APP_ROOT_CLOSE_TAG const appTemplate = APP_ROOT_OPEN_TAG + APP_ROOT_CLOSE_TAG
const loaderTemplate = r ? APP_SPA_LOADER_OPEN_TAG + r + APP_SPA_LOADER_CLOSE_TAG : '' const loaderTemplate = r ? APP_SPA_LOADER_OPEN_TAG + r + APP_SPA_LOADER_CLOSE_TAG : ''
return appTemplate + loaderTemplate return appTemplate + loaderTemplate
@ -230,9 +232,6 @@ async function getIslandContext (event: H3Event): Promise<NuxtIslandContext> {
return ctx return ctx
} }
const APP_SPA_LOADER_OPEN_TAG = `<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>`
const APP_SPA_LOADER_CLOSE_TAG = `</${appSpaLoaderTag}>`
const HAS_APP_TELEPORTS = !!(appTeleportTag && appTeleportAttrs.id) const HAS_APP_TELEPORTS = !!(appTeleportTag && appTeleportAttrs.id)
const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToString(appTeleportAttrs)}>` : '' const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToString(appTeleportAttrs)}>` : ''
const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `</${appTeleportTag}>` : '' const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `</${appTeleportTag}>` : ''