refactor(FE): Conditionally load data based on filter modal state

This commit is contained in:
rstubryan
2026-02-24 15:22:06 +07:00
parent a5b4deaac4
commit 9a5e2987d5
@@ -313,7 +313,7 @@ const RecordingTable = () => {
isLoadingOptions: isLoadingLocationOptions,
loadMore: loadMoreLocations,
} = useSelect<Location>(
LocationApi.basePath,
filterModal.open ? LocationApi.basePath : null,
'id',
'name',
'search',
@@ -325,7 +325,12 @@ const RecordingTable = () => {
options: areaOptions,
isLoadingOptions: isLoadingAreaOptions,
loadMore: loadMoreAreas,
} = useSelect<Area>(AreaApi.basePath, 'id', 'name', 'search');
} = useSelect<Area>(
filterModal.open ? AreaApi.basePath : null,
'id',
'name',
'search'
);
const projectFlockParams = useMemo(() => {
if (filterProjectFlockLocationId) {
@@ -341,7 +346,7 @@ const RecordingTable = () => {
isLoadingOptions: isLoadingProjectFlocks,
loadMore: loadMoreProjectFlocks,
} = useSelect(
ProjectFlockApi.basePath,
filterModal.open ? ProjectFlockApi.basePath : null,
'id',
'flock_name',
'search',