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:
parent
6ee18b0fe0
commit
c9efa26365
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user