📝 State issue fixes

This commit is contained in:
2026-02-24 15:48:38 -05:00
parent 37a2d0c75b
commit 0af9482be9
3 changed files with 107 additions and 31 deletions

View File

@@ -10,7 +10,7 @@ import { useTranslation } from "react-i18next";
import "../../shared/utils/i18n.util";
import PopoverButton from "../shared/PopoverButton";
import dayjs from "dayjs";
import { useMutation } from "@tanstack/react-query";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import {
COMICVINE_SERVICE_URI,
LIBRARY_SERVICE_BASE_URI,
@@ -20,6 +20,7 @@ import axios from "axios";
interface ISearchProps {}
export const Search = ({}: ISearchProps): ReactElement => {
const queryClient = useQueryClient();
const formData = {
search: "",
};
@@ -138,6 +139,10 @@ export const Search = ({}: ISearchProps): ReactElement => {
},
});
},
onSuccess: () => {
// Invalidate and refetch wanted comics queries
queryClient.invalidateQueries({ queryKey: ["wantedComics"] });
},
});
const addToLibrary = (sourceName: string, comicData) =>