diff --git a/site/.gitignore b/site/.gitignore index 4cc84f862..92d79a677 100644 --- a/site/.gitignore +++ b/site/.gitignore @@ -1,6 +1,6 @@ .env -source/data/* -!source/data/versement-mobilité.json +source/public/data/* +!source/public/data/versement-mobilité.json cypress/videos cypress/screenshots cypress/downloads diff --git a/site/scripts/utils.js b/site/scripts/utils.js index ac327fcaa..6838f2a38 100644 --- a/site/scripts/utils.js +++ b/site/scripts/utils.js @@ -7,6 +7,7 @@ const dataDir = join( '..', '..', 'source', + 'public', 'data' ) diff --git a/site/source/App.tsx b/site/source/App.tsx index 8bf3f866b..7587bf1ba 100644 --- a/site/source/App.tsx +++ b/site/source/App.tsx @@ -15,8 +15,10 @@ import { configSituationSelector, situationSelector, } from '@/selectors/simulationSelectors' +import { ErrorBoundary } from '@sentry/react' +import { FallbackRender } from '@sentry/react/types/errorboundary' import rules from 'modele-social' -import { StrictMode, useContext, useMemo } from 'react' +import { ComponentProps, StrictMode, useContext, useMemo } from 'react' import { Helmet } from 'react-helmet-async' import { useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' @@ -34,6 +36,7 @@ import Iframes from './pages/Iframes' import Integration from './pages/integration/index' import Landing from './pages/Landing/Landing' import Nouveautés from './pages/Nouveautes/Nouveautes' +import Offline from './pages/Offline' import Simulateurs from './pages/Simulateurs' import Stats from './pages/Stats/LazyStats' import Provider, { ProviderProps } from './Provider' @@ -106,6 +109,14 @@ const Router = () => { ) } +const CatchOffline = ({ error }: ComponentProps) => { + if (error.message.includes('Failed to fetch dynamically imported module')) { + return + } else { + throw error + } +} + const App = () => { const { t } = useTranslation() const sitePaths = useContext(SitePathsContext) @@ -119,32 +130,35 @@ const App = () => { /> - {/* Passing location down to prevent update blocking */} - - - - - - - - - - + + {/* Passing location down to prevent update blocking */} + + + + + + + + + + - - + + - - - + + + + + {!isEmbedded &&