mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-02 11:51:17 +00:00
fix: create dir mutation wrong query invalidation
This commit is contained in:
@@ -10,6 +10,7 @@ import { atom } from "jotai"
|
||||
import { atomFamily } from "jotai/utils"
|
||||
import { currentAccountAtom } from "@/account/account"
|
||||
import { fetchApi } from "@/lib/api"
|
||||
import type { AtomValue } from "@/lib/jotai-utils"
|
||||
import {
|
||||
DirectoryContent,
|
||||
DirectoryInfo,
|
||||
@@ -179,11 +180,12 @@ export const createDirectoryMutationAtom = atom((get) => {
|
||||
},
|
||||
).then(([_, result]) => result)
|
||||
},
|
||||
onSuccess: (data, _variables, _context, { client }) => {
|
||||
client.setQueryData(
|
||||
get(directoryInfoQueryAtom(data.id)).queryKey,
|
||||
data,
|
||||
)
|
||||
onSuccess: (_data, { parentId }, _context, { client }) => {
|
||||
if (account) {
|
||||
client.invalidateQueries({
|
||||
queryKey: directoryContentQueryKey(account.id, parentId),
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user