mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-18 00:19:49 +01:00
fix: Refresh after import (#3108)
This commit is contained in:
parent
a9121150ff
commit
39d09a0f88
@ -14,11 +14,6 @@ import {
|
||||
import { ValidationStage } from './validate/ValidationStage';
|
||||
import { ImportStage } from './import/ImportStage';
|
||||
import { ImportOptions } from './configure/ImportOptions';
|
||||
import {
|
||||
IMPORT_BUTTON,
|
||||
IMPORT_CONFIGURATION_BUTTON,
|
||||
VALIDATE_BUTTON,
|
||||
} from '../../../../utils/testIds';
|
||||
|
||||
const ModalContentContainer = styled('div')(({ theme }) => ({
|
||||
minHeight: '100vh',
|
||||
|
@ -10,6 +10,8 @@ import { PulsingAvatar } from '../PulsingAvatar';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import { Box } from '@mui/system';
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
import useProject from 'hooks/api/getters/useProject/useProject';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
export const ImportStatusArea = styled(Box)(({ theme }) => ({
|
||||
padding: theme.spacing(4, 2, 2, 2),
|
||||
@ -61,18 +63,24 @@ export const ImportStage: FC<{
|
||||
onClose: () => void;
|
||||
}> = ({ environment, project, payload, onClose }) => {
|
||||
const { createImport, loading, errors } = useImportApi();
|
||||
const { refetch: refreshProject } = useProject(project);
|
||||
const { refetch: refreshChangeRequests } =
|
||||
usePendingChangeRequests(project);
|
||||
const { setToastData } = useToast();
|
||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(project);
|
||||
|
||||
useEffect(() => {
|
||||
createImport({ environment, project, data: JSON.parse(payload) }).catch(
|
||||
error => {
|
||||
createImport({ environment, project, data: JSON.parse(payload) })
|
||||
.then(() => {
|
||||
refreshProject();
|
||||
refreshChangeRequests();
|
||||
})
|
||||
.catch(error => {
|
||||
setToastData({
|
||||
type: 'error',
|
||||
title: formatUnknownError(error),
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const importStatus = toApiStatus(loading, errors);
|
||||
|
Loading…
Reference in New Issue
Block a user