Home > other >  Return value by value without waiting all values to return async C#
Return value by value without waiting all values to return async C#

Time:12-23

I have a situation where I calling API service for data and when displaying that data in frontend, problem is that service I calling have a lot of data so my frontend is waiting for backend to get all data at once so it take ages to load. I can't find any solutions how to pass data to frontend without waiting all values to return and do it value by value? Currently I'm using public async Task, but this approach waiting for all data to comeback before passing it.

CodePudding user response:

What we did we split our call in two calls. First we called API for id and loaded our page. We not fetched all data so it loaded fast. Second we called API for each id we get and just added data to object from first call. We use data from calls for dropdown element so till second call were finished we still can display object id in dropdown.

  • Related