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.
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.
Two things about this:'
!==
comparison rather than loose!=
comparison, since the coercion rules of the latter can be surprising.result
not exist? Can we eliminate that circumstance?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 wonder why these questions weren't raised when the original fix 269c215 was implemented yet they slow down backporting.
Maybe @aholovan could provide the insights you're looking for?
P.S. To quote some guy reporting an issue here on GitHub, "It's unbelievable the effort you guys go to, to avoid fixing the issue."
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.
typeof always returns a string so it's not necessary or standard practice to use strict comparison
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.
Thanks @OZZlE , you are right about unnecessary strict comparison.
@zetlen, 'result' is undefined before all of the swatches are selected. It was the issue as with oldPrice and also with tierPrices. (how to reproduce is described in #8923 pull request)
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.
@aholovan Thanks for the background. Making the
result
always present is a good idea, but it seems to be out of scope for this PR.@korostii I look at a fairly random sample of pull requests; my schedule doesn't allow me to review every single one. I didn't notice that this was a backport, so that's on me!
As for strict comparison, it really is a standard practice in all cases. Linters in standard configuration will complain. But it's all right; in a later project, we'll use an automated tool to change all of these loose comparisons to strict ones. So I will approve this!