braintree-web icon indicating copy to clipboard operation
braintree-web copied to clipboard

Add support to abort hosted fields initialization

Open serhiistotskyi opened this issue 3 years ago • 1 comments

General information

  • SDK version: 3.85.0
  • Environment: any
  • Browser and OS: any

Issue description

I'm showing bank card form in modal window and lazily load braintree hosted fields script when user opens a modal (showing loading wheel). Sometimes, user may decide to not wait and close modal after braintree.hostedFields.create() call but before it was resolved, as a result I get HOSTED_FIELDS_TIMEOUT error.

Desired solution

Provide a way to abort hostedFields.create() initialization.

Workaround

I can catch an error in component and in case it's destroyed, I can ignore HOSTED_FIELDS_TIMEOUT error.

serhiistotskyi avatar Feb 07 '22 15:02 serhiistotskyi

Hello, @serhiistotskyi, thanks for the suggestion. We'll mark this report as an enhancement to consider adding this feature to Hosted Fields, though we can't guarantee that this will be implemented at this moment.

As an additional workaround, you can consider not allowing your customer to close the modal before Hosted Fields reports that it is ready. In this case, you could use a deferred client to render Hosted Fields faster.

jplukarski avatar Feb 14 '22 16:02 jplukarski