This seems important, especially because users can toggle on/off filters quickly and each one triggers a new GetImages request (and now a separate and slower GetImagesCount request).
Figuring out how to store each controller instance in state might be challenging, though. It would be worth looking into whether Apollo-client or RTK Query supports aborting in-flight requests through their APIs.
graphql-request
supports usingAbortController
to abort queries that are in-flight: https://github.com/jasonkuhrt/graphql-request/blob/HEAD/examples/request-cancellation.tsThis seems important, especially because users can toggle on/off filters quickly and each one triggers a new
GetImages
request (and now a separate and slowerGetImagesCount
request).Figuring out how to store each
controller
instance in state might be challenging, though. It would be worth looking into whether Apollo-client or RTK Query supports aborting in-flight requests through their APIs.Related: #196