Skip to content

Commit

Permalink
Merge pull request #1583 from Vizzuality/MRXN23-507-id-55-when-select…
Browse files Browse the repository at this point in the history
…ing-all

[MRXN23-507]: excludes platform-wide features from selected counter and bulk operation
  • Loading branch information
andresgnlez authored Nov 20, 2023
2 parents c3b8420 + 51c3f22 commit c853dea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ const InventoryPanelFeatures = ({ noData: noDataMessage }: { noData: string }):
}
);

const featureIds = allFeaturesQuery.data?.map((feature) => feature.id);
const featureIds = allFeaturesQuery.data
?.filter(({ isCustom }) => isCustom)
.map((feature) => feature.id);

const handleSelectAll = useCallback(
(evt: ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -131,14 +133,6 @@ const InventoryPanelFeatures = ({ noData: noDataMessage }: { noData: string }):
const feature = allFeaturesQuery.data?.find(({ id }) => featureId === id);
const isContinuous = feature.amountRange.min !== null && feature.amountRange.max !== null;

// const isIncluded = newSelectedFeatures.includes(featureId);
// if (!isIncluded) {
// newSelectedFeatures.push(featureId);
// } else {
// const i = newSelectedFeatures.indexOf(featureId);
// newSelectedFeatures.splice(i, 1);
// }

if (isContinuous) {
if (!isIncludedInContinuous) {
continuousFeatures.push(featureId);
Expand Down Expand Up @@ -184,6 +178,12 @@ const InventoryPanelFeatures = ({ noData: noDataMessage }: { noData: string }):
isVisibleOnMap: layerSettings[feature.id]?.visibility ?? false,
}));

useEffect(() => {
if (allFeaturesQuery.isRefetching) {
setSelectedFeaturesIds([]);
}
}, [allFeaturesQuery.isRefetching]);

return (
<div className="flex flex-col space-y-6 overflow-hidden">
<div className="h-full overflow-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const DeleteModal = ({
.getQueryData<{ data: Feature[]; meta: Pagination }>(['all-features', pid], {
exact: false,
})
?.data?.filter(({ id, isCustom }) => selectedFeaturesIds.includes(id) && isCustom) ?? [],
?.data?.filter(({ id }) => selectedFeaturesIds.includes(id)) ?? [],
[queryClient, selectedFeaturesIds, pid]
);

Expand Down

1 comment on commit c853dea

@vercel
Copy link

@vercel vercel bot commented on c853dea Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marxan – ./

marxan-git-develop-vizzuality1.vercel.app
marxan-vizzuality1.vercel.app
marxan23.vercel.app

Please sign in to comment.