Duplicates
Latest version
Current behavior 😯
I'm trying to use query() with createAsync() in one of my page. Like the following,
// routes/(baseLayout)/index.tsx
import { createAsync, query, redirect, RouteDefinition } from "@solidjs/router";
import { Dialog } from "~/components/Dialog";
const getQuote = query(async () => {
const quote = await fetch("https://zenquotes.io/api/random");
throw redirect("/auth/signin");
}, "posts");
function DialogTrigger() {
return <div>Open dialog</div>;
}
export const route = {
info: {
breadcrumbs: {
label: "Home",
path: "/",
},
},
} satisfies RouteDefinition;
export default function Home() {
const quote = createAsync(() => getQuote());
return (
<div>
{JSON.stringify(quote())}
<Dialog trigger={DialogTrigger} />
</div>
);
}
But when i go to the page i got the following error:
I tried to refresh the page over and over again, but no hope. Seems like this will occurred when we have fetch() and redirect() altogether. I've tried to change the query() code with just fetch() or redirect() and it's working as expected.
Expected behavior 🤔
No error occurred.
Steps to reproduce 🕹
Steps:
- Create
query() with fetch() and redirect()
- Go to the corresponding page
- The error will appeared.
Context 🔦
No response
Your environment 🌎
System:
- OS: macOS Tahoe 26.0
- CPU: Apple M3
Binaries:
- Node: v22.15.0
npmPackages:
- "@solidjs/router": "^0.15.4",
- "@solidjs/start": "^1.2.0",
- "solid-js": "^1.9.10",
- "vinxi": "^0.5.8"
Duplicates
Latest version
Current behavior 😯
I'm trying to use
query()withcreateAsync()in one of my page. Like the following,But when i go to the page i got the following error:
I tried to refresh the page over and over again, but no hope. Seems like this will occurred when we have
fetch()andredirect()altogether. I've tried to change thequery()code with justfetch()orredirect()and it's working as expected.Expected behavior 🤔
No error occurred.
Steps to reproduce 🕹
Steps:
query()withfetch()andredirect()Context 🔦
No response
Your environment 🌎