From e63b75688a843b3189101cee778a15c7feaf8948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Thu, 7 Jul 2022 12:20:31 +0200 Subject: [PATCH] Remove "PWA app ready" notification --- site/source/ServiceWorker.tsx | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) 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 && (