1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

fix: flickering dialogue (#2558)

* This PR fixes an issue with flickering states in the change request
dialogue
This commit is contained in:
Fredrik Strand Oseberg 2022-11-29 13:34:30 +01:00 committed by GitHub
parent 87d9466005
commit 5b24b60d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ export const UpdateEnabledMessage = ({
environment,
}: UpdateEnabledMsg) => (
<Typography>
<strong>{enabled ? 'Disable' : 'Enable'}</strong> feature toggle{' '}
<strong>{enabled ? 'Enable' : 'Disable'}</strong> feature toggle{' '}
<strong>{featureName}</strong> in <strong>{environment}</strong>
</Typography>
);

View File

@ -31,7 +31,7 @@ export const useChangeRequestToggle = (project: string) => {
);
const onChangeRequestToggleClose = useCallback(() => {
setChangeRequestDialogDetails({ isOpen: false });
setChangeRequestDialogDetails(prev => ({ ...prev, isOpen: false }));
}, []);
const onChangeRequestToggleConfirm = useCallback(async () => {
@ -48,14 +48,14 @@ export const useChangeRequestToggle = (project: string) => {
}
);
refetchChangeRequests();
setChangeRequestDialogDetails({ isOpen: false });
setChangeRequestDialogDetails(prev => ({ ...prev, isOpen: false }));
setToastData({
type: 'success',
title: 'Changes added to the draft!',
});
} catch (error) {
setToastApiError(formatUnknownError(error));
setChangeRequestDialogDetails({ isOpen: false });
setChangeRequestDialogDetails(prev => ({ ...prev, isOpen: false }));
}
}, [addChangeRequest]);