From ea2086a7f4e1e08ff94eee1bc1150bc463a11004 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Tue, 19 Oct 2021 12:36:51 +0200 Subject: [PATCH] Mutate cache key for project when archiving feature. (#444) * Use useProject hook directly instead of mutating on cache key --- .../src/component/feature/FeatureView2/FeatureView2.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/component/feature/FeatureView2/FeatureView2.tsx b/frontend/src/component/feature/FeatureView2/FeatureView2.tsx index a3aed60be5..162abbedbe 100644 --- a/frontend/src/component/feature/FeatureView2/FeatureView2.tsx +++ b/frontend/src/component/feature/FeatureView2/FeatureView2.tsx @@ -1,9 +1,10 @@ -import { Tabs, Tab } from '@material-ui/core'; +import { Tab, Tabs } from '@material-ui/core'; import { useState } from 'react'; 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 useFeature from '../../../hooks/api/getters/useFeature/useFeature'; +import useProject from '../../../hooks/api/getters/useProject/useProject'; import useTabs from '../../../hooks/useTabs'; import useToast from '../../../hooks/useToast'; import { IFeatureViewParams } from '../../../interfaces/params'; @@ -24,6 +25,7 @@ import { getCreateTogglePath } from '../../../utils/route-path-helpers'; const FeatureView2 = () => { const { projectId, featureId } = useParams(); const { feature, loading, error } = useFeature(projectId, featureId); + const { refetch: projectRefetch } = useProject(projectId); const { a11yProps } = useTabs(0); const { archiveFeatureToggle } = useFeatureApi(); const { toast, setToastData } = useToast(); @@ -43,6 +45,7 @@ const FeatureView2 = () => { show: true, }); setShowDelDialog(false); + projectRefetch(); history.push(`/projects/${projectId}`); } catch (e) { setToastData({