Problem with using the loading.tsx file
Unanswered
zmagar91 posted this in #help-forum
zmagar91OP
I want to implement loading ui in my app by adding
loading.tsx files to route segments. But the problem is that when I add the loading.tsx file to the /jobs and /jobs/[id] route segments and navigate to the /jobs/[id] route from the /jobs route, I get almost infinite page loading. I tried to find out why and I saw in the network tab of the browser console a large number of identical requests from the client to the server. Also I noticed that function fetchJobById in /jobs/[id] route is called at least 7 times. When I remove the loading.tsx file everything is fine. Also when I initially load app from the /jobs/[id] route even with the loading.tsx file everything works fine too. The client makes only one-two requests to the server and the page loads properly, function fetchJobById is called only once. What is wrong with the loading.tsx and why does it provoke so many data requests from the /jobs/[id] route?