tnc-ca-geo / animl-frontend

A frontend web app for viewing & labeling camera trap data by The Nature Conservancy.
https://animl.camera
Other
16 stars 0 forks source link

Implement request cancellation #205

Open nathanielrindlaub opened 6 months ago

nathanielrindlaub commented 6 months ago

graphql-request supports using AbortController to abort queries that are in-flight: https://github.com/jasonkuhrt/graphql-request/blob/HEAD/examples/request-cancellation.ts

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.

Related: #196