Skip to content

Commit

Permalink
[Map] add skip prop on queries in dashboard layers
Browse files Browse the repository at this point in the history
  • Loading branch information
claire2212 committed Nov 14, 2024
1 parent 2086560 commit 2fdf38a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export function ActiveDashboardLayer({ map }: BaseMapChildrenProps) {
const activeDashboardId = useAppSelector(state => state.dashboard.activeDashboardId)

const dashboard = useAppSelector(state => getDashboardById(state.dashboard, activeDashboardId))
const { data: reportings } = useGetReportingsByIdsQuery(dashboard?.dashboard.reportingIds ?? [])
const { data: regulatoryLayers } = useGetRegulatoryLayersQuery()
const { data: ampLayers } = useGetAMPsQuery()
const { data: vigilanceAreas } = useGetVigilanceAreasQuery()
const { data: reportings } = useGetReportingsByIdsQuery(dashboard?.dashboard.reportingIds ?? [], {
skip: !dashboard
})
const { data: regulatoryLayers } = useGetRegulatoryLayersQuery(undefined, { skip: !dashboard })
const { data: ampLayers } = useGetAMPsQuery(undefined, { skip: !dashboard })
const { data: vigilanceAreas } = useGetVigilanceAreasQuery(undefined, { skip: !dashboard })

const openPanel = dashboard?.openPanel
const activeDashboard = dashboard?.dashboard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export function DashboardPreviewLayer({ map }: BaseMapChildrenProps) {
},
[openPanel]
)
const { data: regulatoryLayers } = useGetRegulatoryLayersQuery()
const { data: ampLayers } = useGetAMPsQuery()
const { data: vigilanceAreas } = useGetVigilanceAreasQuery()
const { data: regulatoryLayers } = useGetRegulatoryLayersQuery(undefined, { skip: !dashboard })
const { data: ampLayers } = useGetAMPsQuery(undefined, { skip: !dashboard })
const { data: vigilanceAreas } = useGetVigilanceAreasQuery(undefined, { skip: !dashboard })

const previewLayersVectorSourceRef = useRef(new VectorSource()) as React.MutableRefObject<
VectorSource<Feature<Geometry>>
Expand Down

0 comments on commit 2fdf38a

Please sign in to comment.