Skip to content

Commit

Permalink
Merge pull request #262 from jadmsaadaot/SUBMIT-task#302
Browse files Browse the repository at this point in the history
Invalidate package cache when new document is uploaded
  • Loading branch information
jadmsaadaot authored Jan 27, 2025
2 parents 6254b8b + 5f6c0e7 commit 7c10d13
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const AddDocumentActionButton = ({
});

queryClient.invalidateQueries({
queryKey: [QUERY_KEY.SUBMISSION_PACKAGE, submissionPackageId],
queryKey: [QUERY_KEY.SUBMISSION_PACKAGE, Number(submissionPackageId)],
});
handleAddDocument(addedSubmission);
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { SubmitTableCell } from "@/components/Shared/Table/common";
import { useReplaceSubmussion } from "@/hooks/api/useSubmissions";
import { useParams } from "@tanstack/react-router";
import { saveObject } from "@/hooks/api/useObjectStorage";
import { QUERY_KEY } from "@/hooks/api/constants";
import { useQueryClient } from "@tanstack/react-query";
import { FileUploadButton } from "@/components/Shared/FileUploadButton";

type DocumentRowProps = Readonly<{
Expand All @@ -35,8 +33,6 @@ export default function Row({ documentSubmission }: DocumentRowProps) {
submissionPackageId: Number(submissionPackageId),
});

const queryClient = useQueryClient();

const {
submitted_document: { name, url, folder },
version,
Expand Down Expand Up @@ -85,10 +81,6 @@ export default function Row({ documentSubmission }: DocumentRowProps) {
data: documentData,
},
});

queryClient.invalidateQueries({
queryKey: [QUERY_KEY.SUBMISSION_PACKAGE, submissionPackageId],
});
} catch (e) {
notify.error("Failed to replace document");
} finally {
Expand Down

0 comments on commit 7c10d13

Please sign in to comment.