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

Mutate cache key for project when archiving feature. (#444)

* Use useProject hook directly instead of mutating on cache key
This commit is contained in:
Christopher Kolstad 2021-10-19 12:36:51 +02:00 committed by GitHub
parent 77d66f128a
commit ea2086a7f4

View File

@ -1,9 +1,10 @@
import { Tabs, Tab } from '@material-ui/core'; import { Tab, Tabs } from '@material-ui/core';
import { useState } from 'react'; import { useState } from 'react';
import { Archive, FileCopy } from '@material-ui/icons'; import { Archive, FileCopy } from '@material-ui/icons';
import { Route, useHistory, useParams, Link } from 'react-router-dom'; import { Link, Route, useHistory, useParams } from 'react-router-dom';
import useFeatureApi from '../../../hooks/api/actions/useFeatureApi/useFeatureApi'; import useFeatureApi from '../../../hooks/api/actions/useFeatureApi/useFeatureApi';
import useFeature from '../../../hooks/api/getters/useFeature/useFeature'; import useFeature from '../../../hooks/api/getters/useFeature/useFeature';
import useProject from '../../../hooks/api/getters/useProject/useProject';
import useTabs from '../../../hooks/useTabs'; import useTabs from '../../../hooks/useTabs';
import useToast from '../../../hooks/useToast'; import useToast from '../../../hooks/useToast';
import { IFeatureViewParams } from '../../../interfaces/params'; import { IFeatureViewParams } from '../../../interfaces/params';
@ -24,6 +25,7 @@ import { getCreateTogglePath } from '../../../utils/route-path-helpers';
const FeatureView2 = () => { const FeatureView2 = () => {
const { projectId, featureId } = useParams<IFeatureViewParams>(); const { projectId, featureId } = useParams<IFeatureViewParams>();
const { feature, loading, error } = useFeature(projectId, featureId); const { feature, loading, error } = useFeature(projectId, featureId);
const { refetch: projectRefetch } = useProject(projectId);
const { a11yProps } = useTabs(0); const { a11yProps } = useTabs(0);
const { archiveFeatureToggle } = useFeatureApi(); const { archiveFeatureToggle } = useFeatureApi();
const { toast, setToastData } = useToast(); const { toast, setToastData } = useToast();
@ -43,6 +45,7 @@ const FeatureView2 = () => {
show: true, show: true,
}); });
setShowDelDialog(false); setShowDelDialog(false);
projectRefetch();
history.push(`/projects/${projectId}`); history.push(`/projects/${projectId}`);
} catch (e) { } catch (e) {
setToastData({ setToastData({