Skip to content

Commit

Permalink
perf(storefront): Register SW after page load with default workbox be…
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Sep 1, 2023
1 parent 0428c2f commit ff13573
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/storefront/src/lib/layouts/BaseHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (fetchingApiContext) {
const apiDoc = apiContext.doc;
const state: Record<string, any> = apiDoc || cmsContent || {};
const title = state.meta_title || state.name || state.title || Astro.props.title || settings.name;
const title = state.meta_title || state.name || state.title || settings.name;
const description = state.meta_description || state.short_description || settings.description;
const favicon = settings.icon ? getIconUrl(32) : '/favicon.ico';
const shortcutIcon = settings.icon ? getIconUrl(192) : null;
Expand Down Expand Up @@ -137,9 +137,10 @@ const inlineJSONLd = JSON.stringify({
{metatagsContent?.twitter_username &&
<meta name="twitter:site" content={metatagsContent.twitter_username} />}
<meta name="ecom-store-id" content={String(storeId)}>

<script>
import { registerSW } from 'virtual:pwa-register';
registerSW({ immediate: true });
registerSW({ immediate: false });
</script>
{pwaInfo && <Fragment set:html={pwaInfo.webManifest.linkTag} />}
{(!pwaInfo && !import.meta.env.DEV) &&
Expand Down

0 comments on commit ff13573

Please sign in to comment.