Components dont render on params change ( Very slow ) on Production site, unlike local env
Answered
Belgian Hare posted this in #help-forum
Belgian HareOP
Hi there, I have a route
Ive got no idea whats slowing the production site :/
/freelancer and it has a query param, components show up based on the query param. But in production site they're stuck i.e they dont even show, but its all fine in local development serverIve got no idea whats slowing the production site :/
64 Replies
@Belgian Hare Hi there, I have a route `/freelancer` and it has a query param, components show up based on the query param. But in production site they're stuck i.e they dont even show, but its all fine in local development server
Ive got no idea whats slowing the production site :/
are you navigating with
<Link /> or router.push()?Answer
@Ray are you navigating with `<Link />` or `router.push()`?
Belgian HareOP
<Link/>
cuz its a server component
does
/freelancer show dynamic in the build log?Belgian HareOP
let me check
@Ray does `/freelancer` show dynamic in the build log?
Belgian HareOP
hmm i dont think so 🤔
need to see more code
the code on
getData and the code on the navigation@Ray the code on `getData` and the code on the navigation
Belgian HareOP
import { backendUrl } from "@/constants";
import { cookies } from "next/headers";
const fetchData = async (
apipath: string,
) => {
const url = backendUrl + apipath;
const jwt = cookies().get("lshr_jwt");
if (!jwt) return;
const headers: Record<string, string> = {
authorization: `Bearer ${jwt.value}`,
};
let options: any = { headers: headers };
const res = await fetch(url, options);
return res.json();
};getdata
@Belgian Hare ts
import { backendUrl } from "@/constants";
import { cookies } from "next/headers";
const fetchData = async (
apipath: string,
) => {
const url = backendUrl + apipath;
const jwt = cookies().get("lshr_jwt");
if (!jwt) return;
const headers: Record<string, string> = {
authorization: `Bearer ${jwt.value}`,
};
let options: any = { headers: headers };
const res = await fetch(url, options);
return res.json();
};
the production page change when you open the site on localhost?
@Ray the production page change when you open the site on localhost?
Belgian HareOP
yes
@Belgian Hare yes
what browser is it? have you tried on other browser?
Belgian HareOP
chromium, yes tried on firefox
@Belgian Hare chromium, yes tried on firefox
do you have any dummy account I can test the site on vercel?
also, does it work on locally with
npm run build && npm run start?@Ray also, does it work on locally with `npm run build` && `npm run start`?
Belgian HareOP
yep works faster
@Ray do you have any dummy account I can test the site on vercel?
Belgian HareOP
like dummy vercel account?
or dummy account of the website
@Belgian Hare or dummy account of the website
dummy account of the website
so I can login
Belgian HareOP
lshr.freelancer@skiff.com
ok im in
Belgian HareOP
also one thing i noticed, this doesnt happen anywhere in the site, except for /myjobs route
click view contract there
i never made request to /tnc 🤔
@Ray this shows up when i navigate in /freelancer
verce logs
no idea where's that /tnc coming from
@Belgian Hare https://batbin.me/35396ce71bbc4ff4a6db79903ea5ecf3
code on navigation from line 74
try change the href here to
<Link
href={"/freelancer?jobs=" + item.txt}
className="capitalize"
text={jobs === item.txt ? "primary" : "slate6"}
key={item.txt}
>Belgian HareOP
lemme try
@Ray try change the href here to
ts
<Link
href={"/freelancer?jobs=" + item.txt}
className="capitalize"
text={jobs === item.txt ? "primary" : "slate6"}
key={item.txt}
>
Belgian HareOP
didnt fix it
i'm able to navigate only once, and that too after a page reload, after that not even the params update :((
i'm able to navigate only once, and that too after a page reload, after that not even the params update :((
@Belgian Hare didnt fix it
i'm able to navigate only once, and that too after a page reload, after that not even the params update :((
could you show the code on JobsView
@Belgian Hare didnt fix it
i'm able to navigate only once, and that too after a page reload, after that not even the params update :((
refresh the page if the page is stuck and it will work again
@Ray could you show the code on JobsView
Belgian HareOP
hmm lemme try with a minimal component instead of that one first
Belgian HareOP
@Ray i dont think that component's causing it
everything works locally but not the hosted one at vercel
I saw you are using 13.5.2, could you update next?
and what do you do with
refreshList()?@Ray and what do you do with `refreshList()`?
Belgian HareOP
revalidate current path
@Ray I saw you are using 13.5.2, could you update next?
Belgian HareOP
this i cant
@Belgian Hare revalidate current path
when do you use it?
@Ray when do you use it?
Belgian HareOP
when a job is unsaved , request is made and then current path is revalidated,
Belgian HareOP
oh boi 😨
@Ray it is working for me
Belgian HareOP
was it working with that jobview component on?
it stop working after refresh
Belgian HareOP
weird
idk why it works locally
@Belgian Hare weird
<Link
href={{ query: { jobs: item.txt } }}
className="capitalize"
text={jobs === item.txt ? "primary" : "slate6"}
key={item.txt}
>try this maybe
Belgian HareOP
ok deploying
didnt fix ;((
i hope this issue isnt something like this
I would say try with latest version
Belgian HareOP
hmm alright lets see
Belgian HareOP
works finally @Ray thanks