diff --git a/site/source/ServiceWorker.tsx b/site/source/ServiceWorker.tsx index 0b331c37c..fd224562c 100644 --- a/site/source/ServiceWorker.tsx +++ b/site/source/ServiceWorker.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react' import { Trans, useTranslation } from 'react-i18next' import styled from 'styled-components' import { useRegisterSW } from 'virtual:pwa-register/react' @@ -53,25 +54,16 @@ export const ServiceWorker = () => { }, }) + useEffect(() => { + if (offlineReady) { + setOfflineReady(false) + // eslint-disable-next-line no-console + console.log('App is ready to work offline.') + } + }, [offlineReady, setOfflineReady]) + return ( - {offlineReady && ( - - - L'application est prête à fonctionner hors ligne. - - - - setOfflineReady(false)} - aria-label={t('Fermer')} - > - × - - - - )} - {needRefresh && (