mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
feat: make segments editing work with template milestone strategies (#8964)
This commit is contained in:
parent
828ecf8d63
commit
8ad63bc035
@ -81,9 +81,6 @@ const StyledAccordion = styled(Accordion)(({ theme }) => ({
|
||||
},
|
||||
transition: 'background-color 0.2s ease-in-out',
|
||||
backgroundColor: theme.palette.background.default,
|
||||
'&:hover': {
|
||||
backgroundColor: theme.palette.neutral.light,
|
||||
},
|
||||
'&.Mui-expanded': {
|
||||
marginTop: theme.spacing(3),
|
||||
},
|
||||
|
@ -152,10 +152,31 @@ export const ReleasePlanTemplateAddStrategyForm = ({
|
||||
? String(currentStrategy.parameters.stickiness)
|
||||
: 'default';
|
||||
|
||||
const segmentsMap = allSegments?.reduce(
|
||||
(acc, segment) => {
|
||||
acc[segment.id] = segment;
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, ISegment>,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setSegments([]);
|
||||
if (segmentsMap) {
|
||||
setSegments(
|
||||
(currentStrategy?.segments || []).map((segment) => {
|
||||
return segmentsMap[segment];
|
||||
}),
|
||||
);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentStrategy((prev) => ({
|
||||
...prev,
|
||||
segments: segments.map((segment) => segment.id),
|
||||
}));
|
||||
}, [segments]);
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentStrategy((prev) => ({
|
||||
...prev,
|
||||
|
Loading…
Reference in New Issue
Block a user