Luehang / react-paypal-button-v2

An easy and simple to use React button component to implement PayPal Checkout with Smart Payment Buttons V2 (Version 2).
https://luehangs.site/lue_hang/projects/react-paypal-button-v2
MIT License
273 stars 81 forks source link

AbortController #52

Open goneglobal opened 4 years ago

goneglobal commented 4 years ago

To Do First

Software Package Version: 2.6.1

Describe the bug Love this package firstly... thank-you very much!!!

Using 2 React Components. One does a Paypal Subscription & the other does a Paypal standard payment. I find if I move between the 2 components quickly the Network call to paypal https://www.paypal.com/sdk/js?client-id=etc fails the complete. (eg: one network call started but then another starts and the first fails).

Its extremely minor isssue.

Could be fixed by added the AbortController() - https://developer.mozilla.org/en-US/docs/Web/API/AbortController - this could be used to cancel any existing network calls.

To Reproduce Quickly load the component a second time before the first network call has completed.

Expected behavior Preferred behavior is any existing network calls to 'www.paypal.com' be cancelled.

Desktop (please complete the following information):

Additional context Its a very minor issue but I thought I would add it as it would make the software/npm a little more robust :)