Don't use KResponsiveElementMixin in all ContentCards #8123
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.
Summary
Remove a piece of code that pushes
KResponsiveElementMixin
intoContentCard
in<script>
part aboveexport default
of
ContentCardGroupCarousel
.Due to how files are bundled, the removed piece of code is evaluated on the application start, no matter whether
ContentCardGroupCarousel
is mounted or no. Consequently,KResponsiveElementMixin
is unintentionally used in allContentCards
in the whole app, not only inContentCardGroupCarousel
itself. This means unnecessary performance losses wheneverContentCard
is used on a page becauseKResponsiveElementMixin
sResizeSensor
causes render tree layouts/reflows.Regarding the intended usage for
ContentCard
s that are children ofContentCardGroupCarousel
,elementWidth
andelementHeight
provided byKResponsiveElementMixin
are not used inContentCard
at all, and I haven't noticed any problems with the carousel during testing after removing this code. Removed logic, including the warning in a comment, is quite old. I assume that it might be obsolete.The carousel recording for various screen sizes taken after the update:
References
Related #7525
Reviewer guidance
Please check possible regressions of
ContentCardGroupCarousel
.Currently, it is used in the following places:
Depending on your test data, it's possible that not all carousels will be visible. I took screenshots above after tweaking the code a bit to display carousels all the time so I could test properly all places.
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)