Skip to content

Commit

Permalink
disables pagination for most of lists
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Nov 3, 2023
1 parent e12d945 commit 6733686
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
5 changes: 4 additions & 1 deletion app/hooks/cost-surface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export function useProjectCostSurfaces<T = CostSurface[]>(
headers: {
Authorization: `Bearer ${session.accessToken}`,
},
params,
params: {
disablePagination: true,
...params,
},
}).then(({ data }) => data?.data),
enabled: Boolean(pid),
...queryOptions,
Expand Down
7 changes: 7 additions & 0 deletions app/hooks/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export function useAllFeatures<T = { data: Feature[] }>(
...(sort && {
sort,
}),
disablePagination: true,
},
}).then(({ data }) => data);

Expand All @@ -222,6 +223,9 @@ export function useSelectedFeatures(
headers: {
Authorization: `Bearer ${session.accessToken}`,
},
params: {
disablePagination: true,
},
}).then(({ data }) => data);

return useQuery(['selected-features', sid], fetchFeatures, {
Expand Down Expand Up @@ -355,6 +359,9 @@ export function useTargetedFeatures(
headers: {
Authorization: `Bearer ${session.accessToken}`,
},
params: {
disablePagination: true,
},
}).then(({ data }) => data);

return useQuery(['targeted-features', sid], fetchFeatures, {
Expand Down
2 changes: 1 addition & 1 deletion app/hooks/gap-analysis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ export function usePreGapAnalysis(sId, options: UseFeaturesOptionsProps = {}) {
Authorization: `Bearer ${session.accessToken}`,
},
params: {
'page[number]': pageParam,
...parsedFilters,
...(search && {
q: search,
}),
...(sort && {
sort,
}),
disablePagination: true,
},
});

Expand Down
4 changes: 2 additions & 2 deletions app/hooks/scenarios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,22 +351,22 @@ export function useScenarios(pId, options: UseScenariosOptionsProps = {}) {
};
}, {});

const fetchScenarios = ({ pageParam = 1 }) =>
const fetchScenarios = () =>
SCENARIOS.request({
method: 'GET',
url: '/',
headers: {
Authorization: `Bearer ${session.accessToken}`,
},
params: {
'page[number]': pageParam,
...parsedFilters,
...(search && {
q: search,
}),
...(sort && {
sort,
}),
disablePagination: true,
},
});

Expand Down
2 changes: 2 additions & 0 deletions app/hooks/wdpa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function useWDPACategories({
...(customAreaId && {
'filter[customAreaId]': customAreaId,
}),
disablePagination: true,
},
headers: {
Authorization: `Bearer ${session.accessToken}`,
Expand Down Expand Up @@ -104,6 +105,7 @@ export function useProjectWDPAs<T = WDPA[]>(
...(sort && {
sort,
}),
disablePagination: true,
},
}).then(({ data }) => data.data);

Expand Down
2 changes: 1 addition & 1 deletion app/layout/projects/show/map/legend/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const useFeaturesLegend = () => {
const dispatch = useAppDispatch();
const projectFeaturesQuery = useAllFeatures(
pid,
{ sort: 'feature_class_name' },
{ sort: 'featureClassName' },
{
select: ({ data }) => ({
binaryFeatures:
Expand Down
2 changes: 1 addition & 1 deletion app/layout/scenarios/edit/map/legend/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const useFeaturesLegend = () => {
const dispatch = useAppDispatch();
const projectFeaturesQuery = useAllFeatures(
pid,
{ sort: 'feature_class_name' },
{ sort: 'featureClassName' },
{
select: ({ data }) => ({
binaryFeatures:
Expand Down

0 comments on commit 6733686

Please sign in to comment.