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
fix #3474 making validatedAddress object to prevent exception #3504
Conversation
server/methods/accounts/accounts.js
Outdated
validatedAddress.failedValidation = false; | ||
validatedAddress = { | ||
failedValidation: false | ||
}; | ||
} | ||
} | ||
const validationResults = { validated, fieldErrors: validationErrors, formErrors, validatedAddress }; |
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.
previously, this method returned the address
passed to it, but with your change, it could be replaced with { failedValidation: false }
. This could be fine (I have no idea what the downstream code looks like), but feels like a potentially breaking change.
To be safe, consider checking that validatedAddress
is null/undefined,
// line 294:
if (!validatedAddress) {
validatedAddress = {};
}
validatedAddress.failedValidation = false; // same as it was
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.
@pmn4 Isn't validatedAddress
already being checked at line 285? This snippet is in the else
clause of that check.
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.
oops! my bad. I thought this was the else
for if (validator)
I know this isn't exactly in the scope of this bug, but it would seem to me like both places where |
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 fixes this bug as far as it goes but I think we need to look at this validation again
server/methods/accounts/accounts.js
Outdated
validatedAddress.failedValidation = false; | ||
validatedAddress = { | ||
failedValidation: false | ||
}; | ||
} | ||
} | ||
const validationResults = { validated, fieldErrors: validationErrors, formErrors, validatedAddress }; |
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.
@pmn4 Isn't validatedAddress
already being checked at line 285? This snippet is in the else
clause of that check.
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.
Tested. Verified fixed
Fix for #3474
To test
reaction
Example Product
and go to the checkout sceen.Save and Continue
.