Skip to content

Commit

Permalink
Lazy load map panel
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Apr 2, 2024
1 parent 54caa72 commit ff66c4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ContactsContext,
ContactsType,
} from '../ContactsContext/ContactsContext';
import { ContactsMapPanel } from '../ContactsMap/ContactsMapPanel';
import { DynamicContactsMapPanel } from '../ContactsMap/DynamicContactsMapPanel';

export const ContactsLeftPanel: React.FC = () => {
const {
Expand All @@ -23,7 +23,7 @@ export const ContactsLeftPanel: React.FC = () => {
} = React.useContext(ContactsContext) as ContactsType;

return viewMode === TableViewModeEnum.Map ? (
<ContactsMapPanel
<DynamicContactsMapPanel
data={mapData}
panTo={panTo}
selected={selected}
Expand Down
10 changes: 10 additions & 0 deletions src/components/Contacts/ContactsMap/DynamicContactsMapPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import dynamic from 'next/dynamic';
import { DynamicComponentPlaceholder } from 'src/components/DynamicPlaceholders/DynamicComponentPlaceholder';

export const DynamicContactsMapPanel = dynamic(
() =>
import(
/* webpackChunkName: "ContactsMapPanel" */ './ContactsMapPanel'
).then(({ ContactsMapPanel }) => ContactsMapPanel),
{ loading: DynamicComponentPlaceholder },
);

0 comments on commit ff66c4b

Please sign in to comment.