This commit is contained in:
hamid zarghami
2026-06-21 14:52:20 +03:30
parent ba82744219
commit de45b1f197
19 changed files with 622 additions and 157 deletions
+28 -14
View File
@@ -2,26 +2,40 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useState } from "react";
import {
getRestaurantSlugFromPath,
restorePersistedRestaurantQueries,
} from "@/lib/helpers/themeCache";
function createQueryClient() {
const client = new QueryClient({
defaultOptions: {
queries: {
retry: false,
retryOnMount: false,
},
mutations: {
retry: false,
},
},
});
if (typeof window !== "undefined") {
const slug = getRestaurantSlugFromPath();
if (slug) {
restorePersistedRestaurantQueries(client, slug);
}
}
return client;
}
export function ReactQueryProvider({
children,
}: {
children: React.ReactNode;
}) {
const [queryClient] = useState(
() =>
new QueryClient({
defaultOptions: {
queries: {
retry: false,
retryOnMount: false,
},
mutations: {
retry: false,
},
},
}),
);
const [queryClient] = useState(createQueryClient);
return (
<QueryClientProvider client={queryClient}>