mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 15:48:32 -06:00
working on hot reloading
This commit is contained in:
@@ -38,8 +38,8 @@ export const fileStorageService = {
|
||||
|
||||
async directoryExists(directoryPath: string): Promise<boolean> {
|
||||
try {
|
||||
const stat = await fs.stat(directoryPath);
|
||||
return stat.isDirectory();
|
||||
await fs.access(directoryPath);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,18 @@ import React from "react";
|
||||
import { FC, ReactNode, useState } from "react";
|
||||
import { createQueryClient } from "./queryClient";
|
||||
|
||||
export const MyQueryClientProvider: FC<{
|
||||
export default function MyQueryClientProvider({
|
||||
children,
|
||||
dehydratedState,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
dehydratedState: DehydratedState;
|
||||
}> = ({ children, dehydratedState }) => {
|
||||
}) {
|
||||
const [queryClient] = useState(createQueryClient());
|
||||
|
||||
hydrate(queryClient, dehydratedState);
|
||||
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -123,21 +123,23 @@ export function createSuccessToast(message: string) {
|
||||
);
|
||||
}
|
||||
|
||||
export const createQueryClient = () => new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 0,
|
||||
export function createQueryClient() {
|
||||
return new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 0,
|
||||
},
|
||||
mutations: {
|
||||
onError: addErrorAsToast,
|
||||
retry: 0,
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
queryCache: new QueryCache({
|
||||
onError: addErrorAsToast,
|
||||
retry: 0,
|
||||
},
|
||||
},
|
||||
queryCache: new QueryCache({
|
||||
onError: addErrorAsToast,
|
||||
}),
|
||||
mutationCache: new MutationCache({
|
||||
onError: addErrorAsToast,
|
||||
}),
|
||||
});
|
||||
}),
|
||||
mutationCache: new MutationCache({
|
||||
onError: addErrorAsToast,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
import { MutationCache, QueryCache, QueryClient } from "@tanstack/react-query";
|
||||
|
||||
export const createQueryClientForServer = () => new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 0,
|
||||
export function createQueryClientForServer() {
|
||||
return new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 0,
|
||||
},
|
||||
mutations: {
|
||||
onError: (e) => console.log(e),
|
||||
retry: 0,
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
queryCache: new QueryCache({
|
||||
onError: (e) => console.log(e),
|
||||
retry: 0,
|
||||
},
|
||||
},
|
||||
queryCache: new QueryCache({
|
||||
onError: (e) => console.log(e),
|
||||
}),
|
||||
mutationCache: new MutationCache({
|
||||
onError: (e) => console.log(e),
|
||||
}),
|
||||
});
|
||||
}),
|
||||
mutationCache: new MutationCache({
|
||||
onError: (e) => console.log(e),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user