Offline issue with Blazor WebAssembly

Pedro Batista 0 Reputation points

I have a blazor webassembly app that communicates with an API to read/write a lot of data, and when the app is offline it consumes data from IndexedDB. I've spent a couple of months on this project and it's working great, even offline (kinda). I downloaded it on my phone and tested all scenarios online and offline.

The problem is if I'm offline and I haven't used the app for more than a day, next time I open it it doesn't load anything, a message is prompted to me saying "You're offline". To fix this I have to turn on my data, get the app running, then turn the data off again and then I'll be able to use it in offline mode.

Has anyone ever seen this behaviour before? It's crucial that the app works offline regardless of the amount of days the user hasn't used it.

A set of technologies in the .NET Framework for building web applications and XML web services.
3,773 questions
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,208 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce ( 48,711 Reputation points

    did you use the PWA template?

    offline loading of the app is support by the service-worker.js file in wwwroot folder. the service worker should cache all the files required load the app.

    I would have thought that the server worker managed the indexDB file.

    learn about PWA and service worker:

    0 comments No comments