Happens when static assets are loaded on homepage
cacheChannel.addEventListener('message', e => {
const resourceUrl = new URL(e.data.resource);
const isApiRequest = resourceUrl.pathname === '/api';
- const isCurrentPage = resourceUrl.search.split('/').pop() === metadata.get(window.location.pathname).id;
+ const isCurrentPage = resourceUrl.search.split('/').pop() === metadata.get(window.location.pathname)?.id;
// Only show toast if:
// - Non-static asset (static assets logo.svg, style.css, script.js, etc. are not managed by service worker)
// - The relevant page is open (if the user has multiple tabs open, do not show the toast on unrelated pages)