Skip to content
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: run the class name generator only for loaded rows #3789

Merged
merged 1 commit into from
May 6, 2022

Conversation

vursen
Copy link
Contributor

@vursen vursen commented May 6, 2022

Description

The PR prevents the grid css class name generator from running on the rows that the data provider is still loading. That way the Flow Grid class name generator does no longer receive the cells that don't have _item assigned yet and thus the original error reported in the issue no longer takes place:

Cannot read properties of undefined (reading 'style')

Scenario: When a column group changes its hidden state, it triggers the cells' class names to re-generate. When that coincides with the data provider loading more rows, there may occur a race condition because of using debouncers so that the generator will be invoked on the rows that the virtualizer has already created but which don't have _item assigned yet.

Note, it is fine to just filter out such loading rows before running the generator since the data provider will run the generator as soon as all the rows are loaded anyway.

Fixes vaadin/flow-components#3082

Type of change

  • Bugfix

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@sonarcloud
Copy link

sonarcloud bot commented May 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vursen vursen marked this pull request as ready for review May 6, 2022 09:24
@vursen vursen requested a review from tomivirkki May 6, 2022 10:20
Copy link
Member

@tomivirkki tomivirkki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is legit, verified that it also fixes the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Appending a second header row to Vaadin grid causes an error
4 participants