diff --git a/src/components/App.tsx b/src/components/App.tsx index f0bc2d16..726e2092 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -29,7 +29,6 @@ import { ModalOpen } from "./modals/ModalOpen"; import { ModalShortcuts } from "./modals/ModalShortcuts"; import { ModalDebug } from "./modals/ModalDebug"; import { ModalGlobalState } from "./modals/ModalGlobalState"; -import { ModalAgentWorkspace } from "./modals/ModalAgentWorkspace"; import {downloadGlyphsMetadata, downloadSpriteMetadata} from "../libs/metadata"; import { emptyStyle, replaceAccessTokenInUrl, replaceAccessTokens } from "../libs/style"; @@ -44,6 +43,26 @@ import { type MappedError, type OnStyleChangedOpts, type StyleSpecificationWithI import { DatasetStore } from "../libs/dataset-store"; import type { MapOpenLayers } from "./MapOpenLayers"; +// Keep the agent workspace out of the initial bundle, while still loading it +// by default because the lazy component is rendered with the other modals. +const LazyModalAgentWorkspace = React.lazy(() => + import("./modals/ModalAgentWorkspace").then(({ModalAgentWorkspace}) => ({ + default: ModalAgentWorkspace, + })) +); + +const AgentWorkspaceLoading = () =>