I am building a mobile app for my ecom store.
Most of the app is done but now when we are integrating we are facing some issues,
its mostly related to multiple http requests. (correct me if i am wrong) I think they happen sequentially or one wait for the other to send the response.
Here is the issue, on the landing page of the app we have couple of section which requests server to send the data. First time when we get the data we cache the data in the localstorage for faster load later on.
Now the problem occurs when you navigate to a different section and that section also has to do some http request.
Then that page takes a lot of time to show the data.
There are 4 http requests from the landing page.
Lets say they are A,B,C and D
And there is a page called as new arrivals and it makes one request to get the latest updates from the server. this request is E
So if a user opens the app then the http requests would be executed in following order
A -> B -> C -> D
And then if user decides to navigate to new arrivals page then there is one more http request added in the queue
A -> B -> C -> D -> E
So now user has to wait for each http request to complete to get the response. It takes a lot of time for the new arrivals page content to load. But if i disable the landing page http requests and then i do the whole thing again the new arrivals page loads a lot faster. I am guess since it was first in the queue.
Why is this happening?? Am i doing something wrong? or there is a way to change this behavior?