Skip to content

Revert "refactor: avoid unnecessary re-renders on virtualizer size change (#5650)" - #7205

Merged
vursen merged 13 commits into
mainfrom
revert-5650
Mar 19, 2024
Merged

vursen merged 13 commits into
mainfrom
revert-5650

Conversation

@vursen

@vursen vursen commented Mar 13, 2024 •

Copy link
Copy Markdown
Contributor

Description

The PR reverts #5650 due to several regressions mentioned below, and also adds tests that should prevent such regressions in the future.

Fixes #7079
Fixes #7186
Fixes #7160

Type of change

  • Revert

expect(item.getBoundingClientRect().top).to.be.closeTo(scrollTarget.getBoundingClientRect().top - 10, 1);
});

// FIXME: Fails due to a scroll offset reset caused by _adjustVirtualIndexOffset on scroll event.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a related issue to fix this?

@vursen vursen Mar 14, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question. My plan was to report it after the merge because it's only reproducible with the scroll restoration logic.

@ugur-vaadin

Copy link
Copy Markdown
Contributor

As stated by @tomivirkki, this PR seems to also fix #7160. For that reason, I will move the test in the PR to fix that issue and close that one.

Comment thread dev/virtualizer.html Resolved
el.index = index;
el.id = `item-${index}`;
el.textContent = el.id;
el.style.right = '0';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: Most of the styles are added to make debugging easier.

el.style.display = 'flex';
el.style.alignItems = 'center';
el.style.background = index % 2 === 0 ? '#e7e7e7' : '#d0d0d0';
el.style.height = '30px';

@vursen vursen Mar 18, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: Setting a fixed height prevents test failures related to differences in font rendering across browsers.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

expect(item.getBoundingClientRect().top).to.equal(scrollTarget.getBoundingClientRect().top - 10);
});

it('should not request item updates on size increase', () => {

@vursen vursen Mar 18, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: After this PR is merged, I'll create an issue for further research on how to prevent item updates on size change without sacrificing the scroll restoration.

@vursen
vursen merged commit 87653b4 into main Mar 19, 2024
@vursen
vursen deleted the revert-5650 branch March 19, 2024 06:35
vaadin-bot pushed a commit that referenced this pull request Mar 19, 2024
…ange (#5650)" (#7205)

Co-authored-by: ugur-vaadin <ugur@vaadin.com>
vursen added a commit that referenced this pull request Mar 19, 2024
…ange (#5650)" (#7205) (#7236)

Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
Co-authored-by: ugur-vaadin <ugur@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants