request not rendering and client making extra requests
Unanswered
Spotted Sandpiper posted this in #help-forum
Spotted SandpiperOP
When I put my code into production the next router does not push. I also noticed it was making some extra requests. I am trying to render the dhasboard. here is my code
the router is not pushing
const Page = () => {
const router = useRouter();
const searchParams = useSearchParams();
const origin = searchParams.get("origin");
trpc.authCallback.useQuery(undefined, {
onSuccess: ({ success }) => {
if (success) {
router.push(origin || "/dashboard");
}
},
onError: (err) => {
if (err.data?.code === "UNAUTHORIZED") {
router.push("/sign-in");
}
},
});the router is not pushing
8 Replies
Spotted SandpiperOP
And now the client is making extra request
+ not rendering the dashboard
Spotted SandpiperOP
using nextjs 14
+trpc
@Spotted Sandpiper When I put my code into production the next router does not push. I also noticed it was making some extra requests. I am trying to render the dhasboard. here is my code
const Page = () => {
const router = useRouter();
const searchParams = useSearchParams();
const origin = searchParams.get("origin");
trpc.authCallback.useQuery(undefined, {
onSuccess: ({ success }) => {
if (success) {
router.push(origin || "/dashboard");
}
},
onError: (err) => {
if (err.data?.code === "UNAUTHORIZED") {
router.push("/sign-in");
}
},
});
the router is not pushing
Spectacled bear
@Spotted Sandpiper did u find the answer? I’m facing a similar issue. Works fine locally but does work on vercel
Spotted SandpiperOP
Didn’t really have any time to mess around
I will let you know if I figure it out
I think it’s a next js 14 issue