Fix manifest fetching

This commit is contained in:
Arnaud 2024-10-25 10:28:28 +02:00
parent dfcc0ac054
commit e5616f1b49
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
2 changed files with 9 additions and 6 deletions

8
package-lock.json generated
View File

@ -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"
},

View File

@ -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() {
<div className="fetch-inputContainer">
<Input
id="cid"
value={cid}
placeholder="CID"
inputClassName="fetch-input"
onChange={onCidChange}></Input>