Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {lazy, Suspense, useEffect, useMemo, useState} from 'react';
import React, {lazy, Suspense, useEffect, useState} from 'react';
import {ErrorBoundary} from 'react-error-boundary';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import useLocalize from '@hooks/useLocalize';
Expand All @@ -8,6 +8,8 @@ import useThemeStyles from '@hooks/useThemeStyles';
import type {MapViewProps} from './MapViewTypes';
import PendingMapView from './PendingMapView';

const MapViewImpl = lazy(() => import('./MapViewImpl.website'));

function MapView({ref, ...props}: MapViewProps) {
const {isOffline} = useNetwork();
const {translate} = useLocalize();
Expand All @@ -23,13 +25,6 @@ function MapView({ref, ...props}: MapViewProps) {
setErrorResetKey((key) => key + 1);
}, [isOffline, wasOffline]);

// The only way to retry loading the module is to call `React.lazy` again.
const MapViewImpl = useMemo(
() => lazy(() => import('./MapViewImpl.website')),
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
[errorResetKey],
);

return (
<ErrorBoundary
resetKeys={[errorResetKey]}
Expand Down
Loading