1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: clear query params when click cancel

This commit is contained in:
Youssef 2022-02-16 19:54:30 +01:00
parent f862489fe8
commit b24456b5cf
2 changed files with 12 additions and 6 deletions

View File

@ -8,7 +8,7 @@ import ConditionallyRender from '../../../../../common/ConditionallyRender';
import FeatureStrategiesSeparator from '../FeatureStrategiesSeparator/FeatureStrategiesSeparator'; import FeatureStrategiesSeparator from '../FeatureStrategiesSeparator/FeatureStrategiesSeparator';
import useFeatureStrategiesEnvironmentList from './useFeatureStrategiesEnvironmentList'; import useFeatureStrategiesEnvironmentList from './useFeatureStrategiesEnvironmentList';
import useDropboxMarkup from './useDropboxMarkup'; import { useDropboxMarkup } from './useDropboxMarkup';
import useDeleteStrategyMarkup from './useDeleteStrategyMarkup'; import useDeleteStrategyMarkup from './useDeleteStrategyMarkup';
import useProductionGuardMarkup from './useProductionGuardMarkup'; import useProductionGuardMarkup from './useProductionGuardMarkup';
import FeatureStrategyEditable from '../FeatureStrategyEditable/FeatureStrategyEditable'; import FeatureStrategyEditable from '../FeatureStrategyEditable/FeatureStrategyEditable';

View File

@ -3,13 +3,16 @@ import ConditionallyRender from '../../../../../common/ConditionallyRender';
import classnames from 'classnames'; import classnames from 'classnames';
import { useStyles } from './FeatureStrategiesEnvironmentList.styles'; import { useStyles } from './FeatureStrategiesEnvironmentList.styles';
import { Button } from '@material-ui/core'; import { Button } from '@material-ui/core';
import React from 'react';
import { useHistory } from 'react-router-dom';
const useDropboxMarkup = ( export const useDropboxMarkup = (
isOver: boolean, isOver: boolean,
expandedSidebar: boolean, expandedSidebar: boolean,
setExpandedSidbar setExpandedSidbar: React.Dispatch<React.SetStateAction<boolean>>
) => { ) => {
const styles = useStyles(); const styles = useStyles();
const history = useHistory();
const dropboxClasses = classnames(styles.dropbox, { const dropboxClasses = classnames(styles.dropbox, {
[styles.dropboxActive]: isOver, [styles.dropboxActive]: isOver,
@ -33,7 +36,12 @@ const useDropboxMarkup = (
</div> </div>
<Button <Button
style={{ marginTop: '1rem' }} style={{ marginTop: '1rem' }}
onClick={() => setExpandedSidbar(false)} onClick={() => {
setExpandedSidbar(false);
history.replace({
search: '',
});
}}
> >
Cancel Cancel
</Button> </Button>
@ -42,5 +50,3 @@ const useDropboxMarkup = (
/> />
); );
}; };
export default useDropboxMarkup;