1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-31 13:47:02 +02:00

TODO: add constraint ids for default strategy

which is in the project overview.
This commit is contained in:
Thomas Heartman 2025-07-21 11:54:46 +02:00
parent 6ee18b0fe0
commit c9efa26365
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78

View File

@ -1,5 +1,5 @@
import useSWR, { type SWRConfiguration } from 'swr';
import { useCallback } from 'react';
import { useCallback, useMemo } from 'react';
import { getProjectOverviewFetcher } from './getProjectOverviewFetcher.js';
import type { ProjectOverviewSchema } from 'openapi';
@ -41,8 +41,26 @@ const useProjectOverview = (id: string, options: SWRConfiguration = {}) => {
mutate();
}, [mutate]);
const overriddenData = useMemo(() => {
if (!data) return undefined;
return {
...data,
environments: data.environments?.map((env) => {
return env.defaultStrategy
? {
...env,
defaultStrategy: {
...env.defaultStrategy,
title: 'custom title override',
},
}
: env;
}),
};
}, [data]);
return {
project: data || fallbackProject,
project: overriddenData || fallbackProject,
loading: !error && !data,
error,
refetch,