Hi there! I'm running into a really strange error when using the Tauri integration for RSPC. The following code returns "ReferenceError: window is not defined". I think this is because TauriTransport must be using window somehow.
How do I import TauriTransport for when I'm exclusively client-side? Is there a workaround I'm missing here?
import { FetchTransport, createClient } from "@rspc/client";
import { createReactQueryHooks } from "@rspc/react";
import { QueryClient } from "@tanstack/react-query";
import { TauriTransport } from "@rspc/tauri";
import type { Procedures } from "../../src/bindings";
export const client = createClient<Procedures>({
transport:
typeof window === "undefined" ?
// HYPOTHESIS TauriTransport cannot even be imported since it uses the window api
new FetchTransport("http://localhost:9000/rspc") :
new TauriTransport();
});
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false, // If you want to retry when requests fail, remove this.
},
},
});
export const {
useContext,
useMutation,
useQuery,
useSubscription,
Provider: RSPCProvider,
} = createReactQueryHooks<Procedures>();