-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 minicart promotion region not rendering #25373 #25375
Fix minicart promotion region not rendering #25373 #25375
Conversation
The minicart promotion region was not rendering due to a wrongly written check for the number of items in the 'promotion' region. The code checked for the length property of the observable returned from the getRegion method instead of the array it contained. A fast way would have been to add the missing parentheses to the check (and I made antoher PR doing just that), but I felt that the getRegion(region)().length pattern is a bit hard to read and easy to make a mistake with. Therefore, this commit adds a new method to the lib/core/collection.js component of the Magento_Ui module that can be used to check if a region has any elements associated with it. This commit also replaces all occurences of getRegion(region)().length with a call to the new method.
Hi @mattijv. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
Hi @mattijv, thank you for your contribution! |
Apparently there is some latency to the CLA signing being registered? I'm going to try closing and reopening this PR later. |
Hi @mattijv, thank you for your contribution! |
This is to appease the code style checker.
As far as I can tell, all the remaining failing tests are unrelated to any changes in this PR. |
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.
The suffix check was introduced in a303ce8 and I agree adjustments to comply with it should be done in a separate PR.
@mattijv Thank you for the clarification! |
✔️ QA Passed |
@magento run all tests |
As it seems this PR is tentatively approved as the proper fix, I'll close #25374 as redundant. |
B2B tests are failed |
@magento run all tests |
Hi @mattijv, thank you for your contribution! |
The minicart promotion region was not rendering due to a wrongly written check for the number of items in the 'promotion' region. The code checked for the length property of the observable returned from the getRegion method instead of the array it contained.
A fast way would have been to add the missing parentheses to the check (and I made antoher PR doing just that), but I felt that the getRegion(region)().length pattern is a bit hard to read and easy to make a mistake with.
Description (*)
This PR adds a new method to the lib/core/collection.js component of the Magento_Ui module that can be used to check if a region has any elements associated with it. This commit also replaces all occurences of getRegion(region)().length with a call to the new method.
Fixed Issues (if relevant)
Manual testing scenarios (*)
See related issue.
Questions or comments
This PR is an alternative to #25374. The fix implement in this PR is more involved, but I feel it improves to quality of Magento code and helps avoid similar mistakes in the future.
Contribution checklist (*)