1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-27 13:49:10 +02:00

chore: mark CRs where we'd overwrite strategies

This commit is contained in:
Thomas Heartman 2024-02-02 16:28:04 +09:00
parent f274904ce6
commit b999df8a25
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78

View File

@ -1,8 +1,10 @@
import { Box, styled } from '@mui/material';
import { IChangeRequestUpdateStrategy } from 'component/changeRequest/changeRequest.types';
import { useChangeRequestPlausibleContext } from 'component/changeRequest/ChangeRequestContext';
import { useUiFlag } from 'hooks/useUiFlag';
import { IFeatureStrategy } from 'interfaces/strategy';
import { getChangesThatWouldBeOverwritten } from './strategy-change-diff-calculation';
import { useEffect } from 'react';
const ChangesToOverwriteWarning = styled(Box)(({ theme }) => ({
color: theme.palette.warning.dark,
@ -76,6 +78,13 @@ export const ChangesToOverwrite: React.FC<{
const changesThatWouldBeOverwritten = checkForChanges
? getChangesThatWouldBeOverwritten(currentStrategy, change)
: null;
const { registerWillOverwriteStrategyChanges } =
useChangeRequestPlausibleContext();
useEffect(() => {
if (changesThatWouldBeOverwritten) {
registerWillOverwriteStrategyChanges();
}
}, [changesThatWouldBeOverwritten]);
if (!changesThatWouldBeOverwritten) {
return null;