Skip to content

Commit

Permalink
Filter the integration types with the feature flag within the hook it…
Browse files Browse the repository at this point in the history
…self
  • Loading branch information
Anahkiasen committed May 22, 2024
1 parent 5d19358 commit 5fed536
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions resources/ts/Components/IntegrationTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,25 @@ export const getIntegrationTypesInfo = (t: TFunction) => [
export const useIntegrationTypesInfo = () => {
const { t } = useTranslation();

return useMemo(() => getIntegrationTypesInfo(t), [t]);
return useMemo(() => {
const integrationTypesInfo = getIntegrationTypesInfo(t);

// See https://jira.publiq.be/browse/PPF-481
return uitpasEnabled
? integrationTypesInfo
: integrationTypesInfo.filter(
(integrationTypesInfo) =>
integrationTypesInfo.type !== IntegrationType.UiTPAS
);
}, [t]);
};

export type IntegrationTypesInfo = ReturnType<
typeof getIntegrationTypesInfo
>[number];

export const IntegrationTypes = () => {
const integrationTypesInfo = useIntegrationTypesInfo();

// See https://jira.publiq.be/browse/PPF-481
const filteredIntegrationTypes = uitpasEnabled
? integrationTypesInfo
: integrationTypesInfo.filter(
(integrationTypesInfo) =>
integrationTypesInfo.type !== IntegrationType.UiTPAS
);
const filteredIntegrationTypes = useIntegrationTypesInfo();

return (
<div>
Expand Down

0 comments on commit 5fed536

Please sign in to comment.