Vercel and Suspense Not Working In Production
Answered
Oriental chestnut gall wasp posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Oriental chestnut gall waspOP
I have a React Suspense component using a
I think I'm experiencing [this issue](https://github.com/vercel/next.js/issues/54667) but it seems like it hasn't been resolved yet.
[This](https://github.com/shroommu/pokemon-battler/tree/master/src/app/pokedex/%5Bpokemon%5D) is the relevant directory in my project repo.
I'm pretty sure this is a Vercel problem, but maybe I'm doing something weird in my code?
Production URL is https://pokemon.alexakruckenberg.com/pokedex . The expected behavior is that you should see a loading skeleton in the righthand body element when you select a pokemon from the left.
Sometimes the element will load almost instantaneously, while other times it will hang for almost 5 seconds before updating the URL and loading the selected pokemon's data.
loading.js
file according to the App Router docs. The Suspense works as expected in local environment, but when I deploy to Vercel, it does not work as expected in the production environment.I think I'm experiencing [this issue](https://github.com/vercel/next.js/issues/54667) but it seems like it hasn't been resolved yet.
[This](https://github.com/shroommu/pokemon-battler/tree/master/src/app/pokedex/%5Bpokemon%5D) is the relevant directory in my project repo.
I'm pretty sure this is a Vercel problem, but maybe I'm doing something weird in my code?
Production URL is https://pokemon.alexakruckenberg.com/pokedex . The expected behavior is that you should see a loading skeleton in the righthand body element when you select a pokemon from the left.
Sometimes the element will load almost instantaneously, while other times it will hang for almost 5 seconds before updating the URL and loading the selected pokemon's data.
Answered by Oriental chestnut gall wasp
Also, I noticed that my build time increased from 40s to about 4m after implementing the dynamic routes for each pokemon. Is that normal? I have 151 dynamic routes but I have no frame of reference for how long it takes to build a single dynamic route, so it's hard to know if I've done something wrong there.
2 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Oriental chestnut gall waspOP
Also, I noticed that my build time increased from 40s to about 4m after implementing the dynamic routes for each pokemon. Is that normal? I have 151 dynamic routes but I have no frame of reference for how long it takes to build a single dynamic route, so it's hard to know if I've done something wrong there.
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Oriental chestnut gall waspOP
Update: I committed a terrible faux pas and was using
router.push
instead of Link
for my route navigation. Not sure what I was thinking, but switching over to Link
seems to have solved the issue. I don't think the Suspense
is even getting called, and I don't think I need it.