Description
Preconditions (*)
- M2.3.1 or later (and possibly some later M2.2 versions too)
Steps to reproduce (*)
- Add a component to the 'promotion' region of the minicart jsLayout
Expected result (*)
- Component is rendered
Actual result (*)
- Component is not rendered
Cause
The issue was introduced in #20383 where an if-binding was added to the minicart-widgets div to prevent the div from being rendered if the 'promotion' region does not contain any elements. Unfortunately the if was written badly as the conditional is checking the length
property of the observable returned from getRegion (always 0) instead of the array contained in the observable. This means the conditional is always false and the element is never rendered.
Possible fixes
I've create two mutually exclusive PR's that solve the issue in two ways.
#25374 Fixes the if-clause by adding the missing parentheses.
#25375 Is a bit more involved fix as it adds a separate method to the collection component that can be used to check if a region contains elements. It also modifies existing uses of the getRegion(region)().length
pattern to use the new method.