Dmytro Golovin
Dmytro Golovin

Reputation: 9

NextJS navigation is blocked by fetch request to the API route

I have an NextJS app, and currently working on a page where I want to list DiscountContexts. When I am loading DiscountContexts items, I need to fetch 5 discounts for each item, when they are getting displayed.

So what happens is that I have a request to fetch a list of DiscountContexts, imagine 5 items are fetched, and then I have 5 request to fetch discounts for each of the context.

I use Tanstack Query to handle the requests, and what happens is that while the discounts are being fetched I cannot navigate to a different page.

What I can see in the network tab is that the navigate is being pushed but it is blocked by fetching of discounts.

App print

Does anybody faced similar issue and could help me?

Upvotes: 0

Views: 46

Answers (0)

Related Questions