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 219
Fix initial population of address data in useCustomerData
hook
#5473
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
mikejolley
added
status: needs review
type: bug
The issue/PR concerns a confirmed bug.
block: checkout
Issues related to the checkout block.
labels
Dec 30, 2021
rubikuserbot
requested review from
a team and
ralucaStan
and removed request for
a team
December 30, 2021 16:37
mikejolley
commented
Dec 30, 2021
@@ -27,7 +27,7 @@ export const useCheckoutAddress = () => { | |||
} = useCustomerDataContext(); | |||
|
|||
const currentShippingAsBilling = useRef( shippingAsBilling ); | |||
const previousBillingData = useRef( billingData ); | |||
const previousBillingData = useRef(); |
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.
This prevents it storing the empty address data which will exist on mount.
Size Change: -44 B (0%) Total Size: 819 kB
ℹ️ View Unchanged
|
mikejolley
added
the
status: blocker
Used on issues or pulls that block work from being released.
label
Dec 31, 2021
ralucaStan
approved these changes
Dec 31, 2021
github-actions
bot
added
status: ready to merge
and removed
status: needs review
labels
Dec 31, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block: checkout
Issues related to the checkout block.
status: blocker
Used on issues or pulls that block work from being released.
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.
Fixes the issue described here where address fields are blank on mount. Traced back to this change: #5394
While we don't want to update the server on the initial mount, we do need to sync initial address data with the cart once that's finished initialising. I believe this PR fixes both cases.
useCustomerData
so it tracks when the cart is finished loading, and then initialized itself with the updated address.useCustomerData
to make it easier to maintain.useCustomerData
to useuseDebounceCallback
which is more easy to follow than debouncing several values.useCheckoutAddress
which was also tracking the initial empty address.Fixes #5456
Testing
To avoid further regressions we need to test against all related issues.
batch/
endpoint once the address data is populated.Changelog