Skip to content

Commit 8c6be63

Browse files
committed
lazy load feed page components
1 parent c976adb commit 8c6be63

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/app/components/CoveredAreaMap.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import { computeBoundingBox } from '../screens/Feed/Feed.functions';
3333
import { displayFormattedDate } from '../utils/date';
3434
import { useSelector } from 'react-redux';
3535
import ModeOfTravelIcon from '@mui/icons-material/ModeOfTravel';
36-
import { GtfsVisualizationMap } from './GtfsVisualizationMap';
3736
import ZoomOutMapIcon from '@mui/icons-material/ZoomOutMap';
3837
import { useRemoteConfig } from '../context/RemoteConfigProvider';
3938
import { sendGAEvent } from '@next/third-parties/google';
@@ -45,6 +44,10 @@ import {
4544

4645
// Dynamically import Map and MapGeoJSON for code splitting and bundle size
4746
// Useful since these components are rendered conditionally to the tab and will only import when on page
47+
const GtfsVisualizationMap = dynamic(
48+
async () => await import('./GtfsVisualizationMap').then((mod) => mod.GtfsVisualizationMap),
49+
{ ssr: false },
50+
);
4851
const MapGeoJSON = dynamic(
4952
async () => await import('./MapGeoJSON').then((mod) => mod.MapGeoJSON),
5053
{ ssr: false },

src/app/screens/Feed/components/FeedSummary.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ import {
5151
StyledListItem,
5252
} from '../Feed.styles';
5353
import { getFeatureComponentDecorators } from '../../../utils/consts';
54-
import Locations from '../../../components/Locations';
54+
import dynamic from 'next/dynamic';
5555
import CopyLinkElement from './CopyLinkElement';
56+
57+
const Locations = dynamic(async () => await import('../../../components/Locations'), { ssr: false });
5658
import { formatDateShort } from '../../../utils/date';
5759
import ExternalIds from './ExternalIds';
5860

0 commit comments

Comments
 (0)