Closed webprismdevin closed 10 months ago
Okay, so figured this out by looking at your walkthrough article.
Here's how I solved it:
// ./app/sanity/loader.ts
import { createQueryStore } from "@sanity/react-loader";
// This is the "smallest" possible version of a query store
// Where stega-enabled queries only happen server-side to avoid bundle bloat
export const queryStore = createQueryStore({ client: false, ssr: true });
export const { useLiveMode, useQuery } = queryStore;
import { queryStore } from "~/sanity/loader";
import { client } from "~/sanity/client";
const clientWithToken = client.withConfig({
token: process.env.SANITY_READ_TOKEN,
});
// We need to set the client used by `loadQuery` here, it only affects the server and ensures the browser bundle isn't bloated
queryStore.setServerClient(clientWithToken);
export const { loadQuery } = queryStore;
I was importing queryStore from '@sanity/react-loader' rather than from my loader.ts
I'm following your template for our remix-based site (fresh install w/ npx create-remix@latest).
When in development, this error shows once a change is made and the site hot-reloads.
Any thoughts?