SolidJSS
SolidJS6mo ago
74 replies
exercise

deferStream does not work

import { createAsync, Navigate, query } from "@solidjs/router";

const getShouldRedirect = query(async () => {
  "use server";
  return true;
}, "should-redirect");

export default function Home() {
  const shouldRedirect = createAsync(() => getShouldRedirect(), {
    deferStream: true,
  });

  if (shouldRedirect()) return <Navigate href="/not-found" />;

  return <>why are you here</>;
}

this works when coming from an initial request (server) but not from a <a>
i expected it to work on client like server
why is it like this?
Was this page helpful?