From e5616f1b49bab5ae3e077918352f82b4b04f1fe1 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 25 Oct 2024 10:28:28 +0200 Subject: [PATCH] Fix manifest fetching --- package-lock.json | 8 ++++---- src/components/ManifestFetch/ManifestFetch.tsx | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b83d1c7..af9d3df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@codex-storage/marketplace-ui-components": "^0.0.24", - "@codex-storage/sdk-js": "^0.0.8", + "@codex-storage/sdk-js": "^0.0.9", "@sentry/browser": "^8.32.0", "@sentry/react": "^8.31.0", "@tanstack/react-query": "^5.51.15", @@ -398,9 +398,9 @@ } }, "node_modules/@codex-storage/sdk-js": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@codex-storage/sdk-js/-/sdk-js-0.0.8.tgz", - "integrity": "sha512-NSHwDpWmRVHlCJHUDVr7FZ0HBxpyoFNXHTjPqOPeQDaGlN+5Yzf/9aBU+lmYVdvIk68BQIzlScMIisRf8IYw9A==", + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/@codex-storage/sdk-js/-/sdk-js-0.0.9.tgz", + "integrity": "sha512-HZvfMa0ss155+Q8oxLDHBeCGvIZfWA9/m0it01z3SS7WQvwtIrP2XiWj82LJxl3u98P5yXhfHyj4K44eTI/ibw==", "dependencies": { "valibot": "^0.32.0" }, diff --git a/src/components/ManifestFetch/ManifestFetch.tsx b/src/components/ManifestFetch/ManifestFetch.tsx index 054081b..f094ef2 100644 --- a/src/components/ManifestFetch/ManifestFetch.tsx +++ b/src/components/ManifestFetch/ManifestFetch.tsx @@ -2,11 +2,12 @@ import { Button, Input } from "@codex-storage/marketplace-ui-components"; import "./ManifestFetch.css"; import { ChangeEvent, useState } from "react"; import { CodexSdk } from "../../sdk/codex"; -import { useQuery } from "@tanstack/react-query"; +import { useQuery, useQueryClient } from "@tanstack/react-query"; import { Promises } from "../../utils/promises"; export function ManifestFetch() { const [cid, setCid] = useState(""); + const queryClient = useQueryClient(); const { refetch } = useQuery({ queryFn: () => @@ -15,10 +16,11 @@ export function ManifestFetch() { .then((s) => { if (s.error === false) { setCid(""); + queryClient.invalidateQueries({ queryKey: ["cids"] }); } return Promises.rejectOnError(s); }), - queryKey: ["cids"], + queryKey: ["manifest"], // Disable the fetch to make it available on refetch only enabled: false, @@ -44,6 +46,7 @@ export function ManifestFetch() {