diff --git a/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/index.tsx b/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/index.tsx index 6b1404cc30..ee70f2c8d8 100644 --- a/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/index.tsx +++ b/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/index.tsx @@ -89,9 +89,13 @@ const InventoryPanelCostSurface = ({ noData: noDataMessage }: { noData: string } const handleSelectAll = useCallback( (evt: ChangeEvent) => { - setSelectedCostSurfaceIds(evt.target.checked ? costSurfaceIds : []); + setSelectedCostSurfaceIds( + evt.target.checked + ? filteredData?.filter(({ isCustom }) => isCustom).map((cs) => cs.id) + : [] + ); }, - [costSurfaceIds] + [filteredData] ); const handleSelectCostSurface = useCallback((evt: ChangeEvent) => { diff --git a/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/modals/delete/index.tsx b/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/modals/delete/index.tsx index f7a60e339a..7230cec00c 100644 --- a/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/modals/delete/index.tsx +++ b/app/layout/project/sidebar/project/inventory-panel/cost-surfaces/modals/delete/index.tsx @@ -34,8 +34,9 @@ const DeleteModal = ({ const selectedCostSurfaces = useMemo(() => { return ( - allProjectCostSurfacesQuery.data?.filter(({ id }) => selectedCostSurfacesIds.includes(id)) || - [] + allProjectCostSurfacesQuery.data?.filter( + ({ id, isDefault }) => selectedCostSurfacesIds.includes(id) && !isDefault + ) || [] ); }, [allProjectCostSurfacesQuery.data, selectedCostSurfacesIds]);