mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui.git
synced 2026-06-07 00:59:55 +00:00
Remove mutationKey to avoid confusion with invalidate query
This commit is contained in:
parent
fba2a20869
commit
7a88b342a6
@ -60,7 +60,7 @@ export function AvailabilityForm({
|
||||
|
||||
const max = availabilityMax(space);
|
||||
const isValid = isAvailabilityValid(availability, max);
|
||||
console.info(isValid, max);
|
||||
|
||||
const helper = isValid
|
||||
? "Total size of availability's storage in bytes"
|
||||
: "The total size cannot exceed the space available.";
|
||||
|
||||
@ -21,7 +21,6 @@ export function useAvailabilityMutation(
|
||||
const [error, setError] = useState<Error | null>(null);
|
||||
|
||||
const { mutateAsync } = useMutation({
|
||||
mutationKey: ["availabilities"],
|
||||
mutationFn: ({
|
||||
totalSize,
|
||||
totalSizeUnit,
|
||||
@ -47,6 +46,7 @@ export function useAvailabilityMutation(
|
||||
}).then((s) => Promises.rejectOnError(s));
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["availabilities"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["space"] });
|
||||
|
||||
WebStorage.delete("availability");
|
||||
|
||||
@ -15,7 +15,6 @@ export function LogLevel() {
|
||||
const queryClient = useQueryClient();
|
||||
const [level, setLevel] = useState<CodexLogLevel>("DEBUG");
|
||||
const { mutateAsync, isPending } = useMutation({
|
||||
mutationKey: ["debug"],
|
||||
mutationFn: (level: CodexLogLevel) =>
|
||||
CodexSdk.debug.setLogLevel(level).then((s) => Promises.rejectOnError(s)),
|
||||
onSuccess: () => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { CodexCreateStorageRequestInput } from "@codex-storage/sdk-js";
|
||||
import { CodexSdk } from "../../sdk/codex";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { Promises } from "../../utils/promises";
|
||||
import { WebStorage } from "../../utils/web-storage";
|
||||
import {
|
||||
@ -15,14 +15,16 @@ export function useStorageRequestMutation(
|
||||
state: StepperState
|
||||
) {
|
||||
const [error, setError] = useState<Error | null>(null);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const { mutateAsync } = useMutation({
|
||||
mutationKey: ["purchases"],
|
||||
mutationFn: (input: CodexCreateStorageRequestInput) =>
|
||||
CodexSdk.marketplace
|
||||
.createStorageRequest(input)
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
onSuccess: async () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["mutationKey"] });
|
||||
|
||||
// if (!requestId.startsWith("0x")) {
|
||||
// requestId = "0x" + requestId;
|
||||
// }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user