Skip to content

Commit

Permalink
upcoming: [DI-20595] - edge case fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ankita-akamai committed Dec 9, 2024
1 parent 2854e2d commit d224809
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { FILTER_CONFIG } from '../Utils/FilterConfig';

import type { Dashboard, FilterValue, Region } from '@linode/api-v4';
import type { CloudPulseResourceTypeMapFlag } from 'src/featureFlags';
import { isNil } from 'ramda';

export interface CloudPulseRegionSelectProps {
defaultValue?: FilterValue;
Expand Down Expand Up @@ -57,17 +58,17 @@ export const CloudPulseRegionSelect = React.memo(
(item: CloudPulseResourceTypeMapFlag) =>
item.serviceType === serviceType
);
const supportedRegionsIdList =
resourceTypeFlag?.supportedRegionIds
?.split(',')
.map((regionId: string) => regionId.trim())
.filter((regionId: string) => regionId.length > 0) || [];

if (!supportedRegionsIdList.length) {
if (isNil(resourceTypeFlag?.supportedRegionIds)) {
return regions;
}

const supportedRegionsIdList = resourceTypeFlag.supportedRegionIds
.split(',')
.map((regionId: string) => regionId.trim());

return regions?.filter((region) =>
supportedRegionsIdList?.includes(region.id)
supportedRegionsIdList.includes(region.id)
);
}, [flags.aclpResourceTypeMap, regions, serviceType]);

Expand Down

0 comments on commit d224809

Please sign in to comment.