-
Notifications
You must be signed in to change notification settings - Fork 86
fix: skip calculation when grid is hidden #2244
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
Conversation
If a resize or any event that triggers `iron-resize` happens as the Grid is about to hide, it may lead to some calculations to happen when the Grid is already hidden. That may lead to some misbehavior, like described on the linked issue. This fix checks the visibility status of the Grid to skip metrics calculation in case the Grid is not visible. fix #2127
Kudos, SonarCloud Quality Gate passed!
|
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.
Should this also be done for master branch or it is not relevant there?
It's not relevant because on |
// When this happens, there might be some issues as described | ||
// here https://github.com/vaadin/web-components/issues/2127. | ||
// Skipping any calculation for a hidden Grid. | ||
if (this.hidden) { |
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.
Here, I could also use _isVisible
, which does return Boolean(this.offsetWidth || this.offsetHeight)
. Both works, but _isVisible
is used in other places on the class, while hidden
is not.
if (this.hidden) { | |
if (!this._isVisible) { |
This is a complementary fix of #2244. The original fix works when Grid is directly set to hidden, but fails for other cases, eg. when a Grid's parent get hidden instead. This change uses iron-list`s _isVisible to check Grid's visibility to determine whether any further calculation should be skipped or not. Related to #2127
If a resize or any event that triggers
iron-resize
happens as the Grid is about to hide, it may lead to some calculations to happen when the Grid is already hidden. That may lead to some misbehavior, like described on the linked issue.This fix checks the visibility status of the Grid to skip metrics calculation in case the Grid is not visible.
Fixes #2127
Type of change