Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After a while my pwa looses all caching and data with the error message "Can't connect to the site" #635

Open
trashhead opened this issue Jan 2, 2024 · 3 comments

Comments

@trashhead
Copy link

trashhead commented Jan 2, 2024

I have this pwa and when it works it works almost perfectly. I can kill the app, turn off the internet connection and it still works. The app is hosted internally at my client. So I can also turn off the vpn and open the app and it still works. All the pages and all my offline data/local storage is there. But all of a sudden when I open the application after a few days or a week everything is gone. All the cached resources, all my offline data in local storage is gone. Is there a configuration issue or something else?

Here is my vite pwa-configuration:

plugins: [
    react(),
    VitePWA({
      registerType: 'prompt',
      workbox: {
        globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}']
      },
      manifest: {
        "theme_color": "#005370",
        "background_color": "#005370",
        "icons": [
          {
            src: 'icon192_rounded.png',
            sizes: '192x192',
            type: 'image/png'
          },
          {
            "purpose": "maskable",
            "sizes": "512x512",
            "src": "icon512_maskable.png",
            "type": "image/png"
          },
          {
            "purpose": "any",
            "sizes": "512x512",
            "src": "icon512_rounded.png",
            "type": "image/png"
          }
        ],
        "orientation": "portrait",
        "display": "standalone",
        "dir": "ltr",
        "lang": "sv",
        "name": "QuickTag",
        "short_name": "QuickTag",
        "description": "QuickTag app for inspections"
      }
    })
  ],

This is how the app looks like on the phone when it fails:
image

And this is how the app looks like in chrome remote debugger:
image

Can someone explain why it behaves like this?
It is a showstopper for the client since all data they are creating offline might disappear.

@trashhead trashhead changed the title After a while my pwa losses all caching and data with the error message "Can't connect to site" After a while my pwa looses all caching and data with the error message "Can't connect to site" Jan 2, 2024
@trashhead trashhead changed the title After a while my pwa looses all caching and data with the error message "Can't connect to site" After a while my pwa looses all caching and data with the error message "Can't connect to the site" Jan 2, 2024
@userquin
Copy link
Member

userquin commented Jan 2, 2024

If PWA is installed, check you've disabled clearing app data from Android settings

@trashhead
Copy link
Author

If PWA is installed, check you've disabled clearing app data from Android settings

I am using power saving mode always. Maybe that is one clue to the problem.
One thing I noticed now when I connected my vpn again and opened my app is that in some way my local storage was back. As we can see in the image above it is empty, but when I opened the app all my offline items were back that I had created when I was offline.

Maybe some sort of hibernation of the app due to battery saving?
I will turn off battery saving for a couple of weeks and see if there is a difference.
Thank you for the tip.

@ksielyov
Copy link

Any solution? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants