fix(app): reactive file tree
This commit is contained in:
parent
b07d7cdb71
commit
021d9d105e
4 changed files with 35 additions and 7 deletions
|
|
@ -571,6 +571,18 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
|
|||
}
|
||||
|
||||
const kind = event.properties.event
|
||||
if (kind === "change") {
|
||||
const dir = (() => {
|
||||
if (path === "") return ""
|
||||
const node = tree.node[path]
|
||||
if (node?.type !== "directory") return
|
||||
return path
|
||||
})()
|
||||
if (dir === undefined) return
|
||||
if (!tree.dir[dir]?.loaded) return
|
||||
listDir(dir, { force: true })
|
||||
return
|
||||
}
|
||||
if (kind !== "add" && kind !== "unlink") return
|
||||
|
||||
const parent = path.split("/").slice(0, -1).join("/")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue