Re-render the SPB buttons onError without emptying div first #877
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 callingrender();
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:
onError
handlerChangelog entry
Closes # .