1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-09 01:17:06 +02: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, environment,
}: UpdateEnabledMsg) => ( }: UpdateEnabledMsg) => (
<Typography> <Typography>
<strong>{enabled ? 'Disable' : 'Enable'}</strong> feature toggle{' '} <strong>{enabled ? 'Enable' : 'Disable'}</strong> feature toggle{' '}
<strong>{featureName}</strong> in <strong>{environment}</strong> <strong>{featureName}</strong> in <strong>{environment}</strong>
</Typography> </Typography>
); );

View File

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