Skip to content

Commit 8d349ba

Browse files
authored
Merge pull request #1283 from ashiduDissanayake/api-policy-bug
Fix: Remove silent auto-default category filter from policy list
2 parents 777e318 + 3bba7ae commit 8d349ba

File tree

1 file changed

+2
-20
lines changed
  • portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Policies

1 file changed

+2
-20
lines changed

portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Policies/PolicyList.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ const PolicyList: FC<PolicyListProps> = ({
122122
]);
123123
const canAddPolicy = !isChoreoConnectEnabled && !isPolicyHubGateway;
124124

125-
const isAIAPI = apiSubType === 'AIAPI';
126-
const isRestAPI = apiType === 'HTTP' && !isAIAPI;
127-
128125
const getPolicyCategory = (policy: Policy) => {
129126
const category = policy.category || policy.categories?.[0];
130127
return category || 'Uncategorized';
@@ -147,22 +144,7 @@ const PolicyList: FC<PolicyListProps> = ({
147144
const normalizedSelection = prev.filter((category) =>
148145
availableCategories.includes(category),
149146
);
150-
let nextSelection = normalizedSelection;
151-
152-
// If current selections become invalid, apply API-type defaults when available.
153-
if (nextSelection.length === 0) {
154-
const defaults = isAIAPI
155-
? ['AI', 'Guardrails']
156-
: isRestAPI
157-
? ['Transformation', 'Security']
158-
: [];
159-
const matchingDefaults = defaults.filter((category) =>
160-
availableCategories.includes(category),
161-
);
162-
if (matchingDefaults.length > 0) {
163-
nextSelection = matchingDefaults;
164-
}
165-
}
147+
const nextSelection = normalizedSelection;
166148

167149
if (
168150
nextSelection.length !== prev.length ||
@@ -174,7 +156,7 @@ const PolicyList: FC<PolicyListProps> = ({
174156
}
175157
return prev;
176158
});
177-
}, [availableCategories, isAIAPI, isRestAPI]);
159+
}, [availableCategories]);
178160

179161
const handleAddPolicy = () => {
180162
setDialogOpen(true);

0 commit comments

Comments
 (0)