image not loading on mobile after lock/unlock

This commit is contained in:
Ajay Bura
2026-02-15 13:27:57 +05:30
parent 9d49418a1f
commit 03c285b461

View File

@@ -27,10 +27,24 @@ if ('serviceWorker' in navigator) {
? `${trimTrailingSlash(import.meta.env.BASE_URL)}/sw.js` ? `${trimTrailingSlash(import.meta.env.BASE_URL)}/sw.js`
: `/dev-sw.js?dev-sw`; : `/dev-sw.js?dev-sw`;
navigator.serviceWorker.register(swUrl).then(() => { const sendSessionToSW = () => {
const session = getFallbackSession(); const session = getFallbackSession();
pushSessionToSW(session?.baseUrl, session?.accessToken); pushSessionToSW(session?.baseUrl, session?.accessToken);
};
navigator.serviceWorker.register(swUrl).then(sendSessionToSW);
navigator.serviceWorker.ready.then(sendSessionToSW);
window.addEventListener('load', sendSessionToSW);
// When returning from background
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') {
sendSessionToSW();
}
}); });
// When restored from bfcache (important on iOS)
window.addEventListener('pageshow', sendSessionToSW);
} }
const mountApp = () => { const mountApp = () => {