diff --git a/.eslintrc.js b/.eslintrc.js index e8fbc9ab..552bc7c3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,6 +23,9 @@ module.exports = { 'react/prop-types': 0, 'react/require-default-props': 0, 'no-await-in-loop': 'warn', + 'no-multi-spaces': ['error', { + ignoreEOLComments: true, + }], 'no-plusplus': [ 'error', { diff --git a/src/components/PWAIcon.jsx b/src/components/PWAIcon.jsx index b8f649b6..10aa8c62 100644 --- a/src/components/PWAIcon.jsx +++ b/src/components/PWAIcon.jsx @@ -6,6 +6,8 @@ import { IconButton, Tooltip } from '@material-ui/core'; import { CheckCircle, Download } from '../icons'; +const intervalMS = 60 * 60 * 1000; // 1 hour + const PWAIcon = () => { const { offlineReady: [offlineReady, setOfflineReady], @@ -14,6 +16,13 @@ const PWAIcon = () => { } = useRegisterSW({ onRegistered: (registration) => { console.debug('[PWA] onRegistered', registration); + + if (registration) { + // Check for updates regularly + setInterval(() => { + registration.update(); + }, intervalMS); + } }, onRegisterError: (error) => { console.log('onRegisterError', error);