upgrade react-query to v5
This commit is contained in:
@@ -24,10 +24,10 @@ const PathManager = ({ currentPathId = 1, onPathChange }) => {
|
||||
let current_id = pathId;
|
||||
while (current_id) {
|
||||
try {
|
||||
const pathData = await queryClient.fetchQuery(
|
||||
["path", current_id],
|
||||
() => fetch_(`${config.BACKEND_HOST}/api/path/${current_id}`)
|
||||
);
|
||||
const pathData = await queryClient.fetchQuery({
|
||||
queryKey: ["path", current_id],
|
||||
queryFn: () => fetch_(`${config.BACKEND_HOST}/api/path/${current_id}`)
|
||||
});
|
||||
if (!pathData) break;
|
||||
path.unshift({ name: pathData.name, id: pathData.id });
|
||||
current_id = pathData.parent_id;
|
||||
@@ -71,8 +71,8 @@ const PathManager = ({ currentPathId = 1, onPathChange }) => {
|
||||
{ name: searchTerm.trim(), parent_id: currentPathId },
|
||||
{
|
||||
onSuccess: (newDir) => {
|
||||
queryClient.setQueryData(["path", newDir.id], newDir);
|
||||
queryClient.invalidateQueries(["paths", currentPathId]);
|
||||
queryClient.setQueryData({queryKey: ["path", newDir.id]}, newDir);
|
||||
queryClient.invalidateQueries({queryKey: ["paths", currentPathId]});
|
||||
setSearchTerm("");
|
||||
alert("Directory created successfully.");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user