Grouping requests into a single request #5791
-
I'm looking to implement some functionality to reduce the number of requests made to our backend and was wondering if anyone has tried to solve this issue before I dive in and write something bespoke. I'll use a contrived scenario to illustrate the issue: I have a list of orders that have a customer ID on them. In the UI I want to display the list of orders, but instead of showing the customer ID, I'd like to fetch the customer and display the name of the customer. This is fine with short lists, but can result in large numbers of requests with long lists. One option is to make the fetching based on visibility of the order, fetching the customer only when the order is on screen. However, the better option for our case would be to be able to group together requests for customer 1 and customer 2 and use an endpoint that allows us to get the customer records for both customers. Ideally this would then populate the cache for the customer query key that allows us to get a single customer by ID. I think this is going to require something bespoke, but would be interested to hear how others may have solved similar issues. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
see: |
Beta Was this translation helpful? Give feedback.
see: