Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FE(fix): show features on gap analysis grid legend #1621

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export const ScenariosFeaturesTargets = ({ onGoBack }: { onGoBack: () => void })
{
onSuccess: async () => {
await queryClient.invalidateQueries(['selected-features', sid]);
await queryClient.invalidateQueries(['pre-gap-analysis', sid]);
},
onSettled: () => {
setSubmitting(false);
Expand Down
13 changes: 2 additions & 11 deletions app/layout/scenarios/edit/map/legend/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { orderBy, sortBy } from 'lodash';

import { useProjectCostSurfaces } from 'hooks/cost-surface';
import { useAllFeatures, useSelectedFeatures } from 'hooks/features';
import { useAllGapAnalysis } from 'hooks/gap-analysis';
import { useAllGapAnalysis, usePreGapAnalysis } from 'hooks/gap-analysis';
import { LEGEND_LAYERS } from 'hooks/map/constants';
import { useProject } from 'hooks/projects';
import { useScenario } from 'hooks/scenarios';
Expand Down Expand Up @@ -378,16 +378,7 @@ export const useGapAnalysisLegend = () => {
(state) => state[`/scenarios/${sid}/edit`]
);

const gapAnalysisQuery = useAllGapAnalysis(sid, {
select: (data) =>
sortBy(
data.map(({ id, featureClassName }) => ({
id,
name: featureClassName,
})),
['name']
),
});
const gapAnalysisQuery = usePreGapAnalysis(sid, {});

return LEGEND_LAYERS['gap-analysis']({
items: gapAnalysisQuery.data,
Expand Down
Loading