This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 221
Fix runaway state change loop for showing validation errors in event subscription. #2119
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nerrad
requested review from
mikejolley and
Aljullu
and removed request for
a team
April 3, 2020 19:47
nerrad
added
focus: components
Work that introduces new or updates existing components.
type: bug
The issue/PR concerns a confirmed bug.
labels
Apr 3, 2020
Size Change: +14 B (0%) Total Size: 2.17 MB
ℹ️ View Unchanged
|
Aljullu
approved these changes
Apr 4, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the same while working on #2112. 👍
I have a PR almost ready fixing that issue and there I refactor this part of the code too. I ended up hooking up this useEffect
with onCheckoutProcessing
. I can explain it further once I create the PR, but I wanted to point it out before approving this one.
tl;dr I'm approving this PR but I will soon create another one with some changes here as well. 🙂
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
focus: components
Work that introduces new or updates existing components.
type: bug
The issue/PR concerns a confirmed bug.
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.
While working on #2054, in testing I noticed that we were getting in infinite set state loop due to the event subscription for validation errors happening in
checkout/block.js
. As discovered in #2108, event observers cannot set context state (because the observers have no awareness of state changes and thus can be executing on stale contexts - which in turn can create this loop).As a result, I've reconfigured the logic causing this error to react to checkout status and error state instead.
To test
I've been testing this the pull I'm doing for #2054 and verified this fixes the loop. I'm not sure how to test this other than that (the pull isn't published yet), so this could just get a code review for now and it will get more testing against payment method error creation as we start polishing that off.