askvortsov1 / flarum-pwa

Progressive Web App support for Flarum
MIT License
34 stars 12 forks source link

Add Auto Refresh When Open #16

Open mikejones3 opened 3 years ago

mikejones3 commented 3 years ago

Sometimes when IO open the PWA there it is not refreshed and is stale. For example I know someone posted but when I click the PWA icon on my android for an open the app, I won't see the new post until I pull down to refresh.

If there was a way to force a refresh on open that would be great!

askvortsov1 commented 3 years ago

From what I've seen when searching about this, opening the PWA is viewed similarly to opening a browser tab. Maybe a test of window.onfocus iff in PWA mode should trigger a refresh? I'll need to test this to make sure it's not refreshing unnecessarily.

Maybe there should also be a time threshold?