Spaces:
Configuration error
Configuration error
Download frontend/src/query-client-config.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/query-client-config.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/query-client-config.ts
-
curl -L -o query-client-config.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/query-client-config.ts
1.02 kB
| import { | |
| QueryClientConfig, | |
| QueryCache, | |
| MutationCache, | |
| } from "@tanstack/react-query"; | |
| import { retrieveAxiosErrorMessage } from "./utils/retrieve-axios-error-message"; | |
| import { displayErrorToast } from "./utils/custom-toast-handlers"; | |
| const shownErrors = new Set<string>(); | |
| export const queryClientConfig: QueryClientConfig = { | |
| queryCache: new QueryCache({ | |
| onError: (error, query) => { | |
| if (!query.meta?.disableToast) { | |
| const errorMessage = retrieveAxiosErrorMessage(error); | |
| if (!shownErrors.has(errorMessage)) { | |
| displayErrorToast(errorMessage || "An error occurred"); | |
| shownErrors.add(errorMessage); | |
| setTimeout(() => { | |
| shownErrors.delete(errorMessage); | |
| }, 3000); | |
| } | |
| } | |
| }, | |
| }), | |
| mutationCache: new MutationCache({ | |
| onError: (error, _, __, mutation) => { | |
| if (!mutation?.meta?.disableToast) { | |
| const message = retrieveAxiosErrorMessage(error); | |
| displayErrorToast(message); | |
| } | |
| }, | |
| }), | |
| }; | |