Skip to content

Cancel Fetch on Unmount (and Other Updates)#21

Closed
RobertFischer wants to merge 7 commits into
seekshiva:masterfrom
BeeWell:rcf/ensure-fetch-cancelled
Closed

Cancel Fetch on Unmount (and Other Updates)#21
RobertFischer wants to merge 7 commits into
seekshiva:masterfrom
BeeWell:rcf/ensure-fetch-cancelled

Conversation

@RobertFischer

Copy link
Copy Markdown

This PR does the following things:

  1. Add in PropTypes so that we give our users feedback on whether or not they are passing the correct parameters. (They can remove them in production using babel-plugin-transform-react-remove-prop-types.)
  2. Capture the promise that is performing the fetch, so that we can cancel it on unmount. This saves a memory leak and a warning message whenever someone navigates away before the fetch resolves.
  3. Switch to Bluebird so that we have the promise.cancel() functionality required in Large SVG #3.
  4. Chain the promises, so multiple rapid changes would still all be cancelled on unmount.
  5. Move off of deprecated React.Component methods to their contemporary alternatives.

@RobertFischer

Copy link
Copy Markdown
Author

If you merge both this and #20, then you'll want to pull from my rcf/ensure-fetch-cancelled-with-debug branch instead.

@seekshiva

Copy link
Copy Markdown
Owner

fetch abort has been implemented using AbortController and released in 2.0.10.

@seekshiva seekshiva closed this Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants