invalidate local cache when moving dir

This commit is contained in:
Djeeberjr 2021-11-22 01:28:44 +01:00
parent 1683c0d467
commit 9462a74437

View File

@ -16,6 +16,7 @@ import { ReactComponent as Spinner } from "./../assets/spinner.svg"
import FileBrowserList from "./FileBrowserList" import FileBrowserList from "./FileBrowserList"
import MoreMenu from "./MoreMenu" import MoreMenu from "./MoreMenu"
import ObjID from "../types/ObjID" import ObjID from "../types/ObjID"
import cache from "../Cache"
const FileBrowser: React.FC<RouteComponentProps> = (props) => { const FileBrowser: React.FC<RouteComponentProps> = (props) => {
const path = ObjID.fromURI(props.location.pathname) const path = ObjID.fromURI(props.location.pathname)
@ -86,6 +87,11 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
if (pasteAction === Action.DirMove && srcID){ if (pasteAction === Action.DirMove && srcID){
await moveDirMutation({variables:{src:srcID,dest:path}}) await moveDirMutation({variables:{src:srcID,dest:path}})
refetchDir() refetchDir()
cache.evict({
id: `Directory:${srcID.toString()}` // TODO: check for a better way to generate cache ids
})
setSrcID(null) setSrcID(null)
} }