SolidJSS
SolidJSโ€ข16mo agoโ€ข
4 replies
sh03

SSR with `query`

I'm trying to use
@solidjs/router
's
query
like this:

const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

export const fetchData = query(async (id: string) => {
  "use server";

  await wait(100);

  return { id };
}, "data");


and I have
ssr: true
in my app config.

If I disable JS and make a request in a route like this:

const data = createAsync(() => fetchData("Yo"));


it doesn't SSR the page (in fact the page remains white with no errors neither on the client nor on the server).

Is
query
supposed to be called on the server or how can I SSR async server-only queries?
Was this page helpful?