Caching endpoint not working - even with segment caching
Unanswered
Shiba Inu posted this in #help-forum
Shiba InuOP
I'm having a lot of problems with fetching data from Discord's API and getting rate limited. This is caused by having multiple SSR components that all call the same endpoint.
For example:
1. the middleware calls the endpoint to get all the guilds and check if a user validated
2. then there is a dropdown server component that calls the endpoint to get all guilds
3. then additionally there is a server component which loads a search bar with the same endpoint again, by the server
because of this the discord api will return 429 errors because im hitting their endpoint twice. I thought next.js components were cached and deduplicated automatically though so I don't see why its not doing so.
I know I can get the servers in the page or layout themselves and pass them down but I wanted to avoid this complexity and reliance.
For example:
1. the middleware calls the endpoint to get all the guilds and check if a user validated
2. then there is a dropdown server component that calls the endpoint to get all guilds
3. then additionally there is a server component which loads a search bar with the same endpoint again, by the server
because of this the discord api will return 429 errors because im hitting their endpoint twice. I thought next.js components were cached and deduplicated automatically though so I don't see why its not doing so.
I know I can get the servers in the page or layout themselves and pass them down but I wanted to avoid this complexity and reliance.
