Skip to content

Commit 49ede0f

Browse files
authoredMar 22, 2024··
fix: Allows offline mutations in dev/test mode (#452)
1 parent 5e2a587 commit 49ede0f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎src/lib/trpc/TrpcProvider.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const getBaseUrl = () => {
1818
return env.NEXT_PUBLIC_BASE_URL;
1919
};
2020

21+
const networkMode =
22+
env.NEXT_PUBLIC_NODE_ENV !== 'production' ? 'always' : undefined;
23+
2124
export function TrpcProvider(props: { children: React.ReactNode }) {
2225
const [showDemo, setShowDemo] = useState(false);
2326

@@ -26,8 +29,10 @@ export function TrpcProvider(props: { children: React.ReactNode }) {
2629
new QueryClient({
2730
defaultOptions: {
2831
queries: {
29-
networkMode:
30-
env.NEXT_PUBLIC_NODE_ENV !== 'production' ? 'always' : undefined,
32+
networkMode,
33+
},
34+
mutations: {
35+
networkMode,
3136
},
3237
},
3338
mutationCache: new MutationCache({

0 commit comments

Comments
 (0)
Please sign in to comment.