All Questions

Coding

Is there’s anyone here who knows what’s causing this?

Very few users who installed the PWA for Habits Garden reported being stuck on the loading screen right after clicking on the icon on home screen (see attached)

• Closing the app won’t fix it, it’s permanent

• Stack Overflow doesn’t know the answer

• To fix, user must clear all cache data (looks like a caching issue)

author Marc Lou

Reply
16 Answers

Let me check

writen by WBE User

Mind sharing the manifest and sw.js link?

writen by WBE User

https://habitsgarden.com/manifest.json

https://habitsgarden.com/sw.js

The SW was automatically generated by next-pwa package (uses Workbox)

Thanks Ankit

writen by Marc Lou

oh, that’s really weird. I had a PWA in the past, using Workbox (but not next-pwa). I really can’t image what could be the reason.

Do you know the browser and OS version of such users? How many of them are reporting the issue?

writen by Luca Restagno (ikoichi on Twitter)

Can you try using custom domain for Plausible? IK weird answer but it might just work.

writen by WBE User

This might be blocking the WorkBox thread

writen by WBE User

oh good catch! this is what I did for OneSignal in the next.config.js file

module.exports = {
reactStrictMode: true,
async rewrites() {
return [
{
source: '/OneSignal-OneSignalSDKWorker.js',
destination: '<https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js>',
},
]
},
}```
A similar solution for plausible could fix it.

writen by Luca Restagno (ikoichi on Twitter)

WBE User by having a custom domain, do you mean hosting the Plausible script on a cdn for instance?

writen by Marc Lou

Otherwise, wouldn’t it better more scalable to tell workbox to bypass some fetch calls?

There are other 3rd parties in the app (OneSignal for instance) that would also create this weird bug w/ Workbox

writen by Marc Lou

Luca Restagno (ikoichi on Twitter) Users can’t even load the app—it’s completely frozen. So there is not way for them to reach me out… Cant tell more about the users OS/browser.

writen by Marc Lou

Marc, look at my script above. You configure NextJS to redirect a URL on your domain, to an external URL (the JS script).

You’ll need something like

source: '/script.js',
destination: '<https://plausible.io/js/script.js>',
},```
so `<https://habitsgarden.com/plausible.js>` redirects to `<https://plausible.io/js/script.js>`
then you just need to update the import of <https://plausible.io/js/script.js> to `<https://habitsgarden.com/plausible.js|/plausible.js>` in your code.

writen by Luca Restagno (ikoichi on Twitter)

Alright, I just updated the app according to Luca Restagno (ikoichi on Twitter)’s config (thanks buddy)

<@U045DD7MCE8> do you think the Plausible script got blocked by adblocker, triggering an uncatched error in the workbox script, resulting in an infinite load?

I’ll update here if it works. I appreciate your help!

writen by Marc Lou

Btw, the plausible script is ‘defer’. Even if it’d crash, I’m not sure it would impact the initial loading of the pwa

writen by Marc Lou

TBH, I didn’t see the splash screen error, so I couldn’t debug. What I’m guessing is the SW is waiting for Plausible, but net gets. Sometimes browsers can act weird.

writen by WBE User

Alright no problem, thanks for checking it out!

writen by Marc Lou

Do you want to ask a question?


Related Questions