explorer icon indicating copy to clipboard operation
explorer copied to clipboard

Cancel API calls when unmounting components

Open sarathms opened this issue 6 years ago • 4 comments

Components which initiate network calls to API server should cancel requests in progress if having to unmount unexpectedly.

Use the cancelToken feature in axios to achieve this.

Components like WebsitesSection, NetworkPropertiesSection etc.

sarathms avatar Apr 16 '19 21:04 sarathms

Is this the same as: https://github.com/ooni/explorer/issues/20 or is it something different?

hellais avatar Nov 13 '19 13:11 hellais

They are related but not the same. I opened this as a general best practice to cancel requests started by components which are about to unmount from the DOM tree.

sarathms avatar Nov 20 '19 18:11 sarathms

Tentatively put it in next cycle. @sarathms can you add an effort estimate to it?

hellais avatar Jan 31 '20 13:01 hellais

This effort should be merged with and done when implementing switching all API calls using swr.

sarathms avatar Sep 28 '20 16:09 sarathms