Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-render the SPB buttons onError without emptying div first #877

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

mattallan
Copy link
Contributor

Ticket: 4142422-zen
Slack thread: p1626405450393600-slack-C7U3Y3VMY


Description

A customer is reporting an issue with how we are calling JQuery( selector ).empty(); before re-rendering the SPB onError handling. In their report, they say the buttons aren't being rendered and that removing this line fixes the issues.

I went back through the history of where this line was added and it was added to fix this issue mentioned here: #668 (comment)

I couldn't find anything in the PayPal docs saying we should remove SPB before calling render, and from my testing you don't need to do this either.

In the original PR, I shared a video of why we needed to re-render the buttons (ttps://d.pr/v/Kj4wgP), and I've tested this case with these changes and couldn't see any issues. I also modified the code to reject/throw an error onAuthorize and there were no issues with just calling render();

At first I was a little reluctant to make this change since we haven't received any reports of this error but if there's one, there's definitely others.

If we don't want to change this behaviour for all stores, another solution would be to add support for a new SDK arg that stores can add by filter to not empty the div before rendering.

Steps to test:

  1. Enable PPEC SPB
  2. Add a product to the cart and visit the checkout
  3. Invalidate the checkout process but emptying the first name field
  4. Click on the SPB debit card button to trigger the onError handler
  5. Notice form is rendered without issues

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

Closes # .

 - I couldn't find any history on why we had to empty the buttons before rendering them, but this is causing a customer issues.
 - From my testing, simply rendering the fields is enough
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.

1 participant