Skip to content

[virtualizer] Elements are not updated after size decrease in large lists (>100 000 elements) #7186

Closed

Description

@vursen

Description

Finding from #7079

Elements don't get updated after scrolling to an extremely distant item (with index > 100 000) and then reducing the virtualizer's size to a value that is still beyond 100 000. The size change seems to come into effect only once you scroll back and forth past the index 100 000, which is the highest index supported by Polymer iron list.

Expected outcome

Elements should be updated on size changes.

Minimal reproducible example

<script type="module">
  import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';

  const scrollTarget = document.querySelector('#scroll-target');
  const scrollContainer = document.querySelector('#scroll-container');

  const virtualizer = new Virtualizer({
    createElements: (count) => [...Array(count)].map(() => document.createElement('div')),
    updateElement: (el, index) => (el.textContent = `Item ${index}`),
    scrollTarget,
    scrollContainer,
    reorderElements: true,
  });

  virtualizer.size = 1000000;

  const scrollTo900000 = document.querySelector('.scroll-to-900000');
  scrollTo900000.addEventListener('click', () => {
    virtualizer.scrollToIndex(900000);
  });

  const reduceSizeTo900000 = document.querySelector('.reduce-size-to-900000');
  reduceSizeTo900000.addEventListener('click', () => {
    virtualizer.size = 900000;
  });
</script>

<div style="height: 300px; position: relative" id="scroll-target">
  <div id="scroll-container"></div>
</div>

<button class="scroll-to-900000">Scroll to index 900000</button>
<button class="reduce-size-to-900000">Reduce size to 900000</button>

Steps to reproduce

  1. Click on "Scroll to index 900000"
  2. Click on "Reduce size to 900000"
  3. See that nothing happens

Environment

Vaadin version(s): 24.4 and possibly earlier
OS: Mac OS

Browsers

Issue is not browser related

Activity

  1. changed the title [-][virtualizer] Elements are not updated after size decrease in large lists (>500 000 elements)[/-] [+][virtualizer] Elements are not updated after size decrease in large lists (>100 000 elements)[/+] on Mar 8, 2024
  2. vursen commented on Mar 11, 2024

    @vursen
    ContributorAuthor

    This is a regression introduced by #5650.

  3. vursen commented on Mar 13, 2024

    @vursen
    ContributorAuthor

    The issue is also reproducible when increasing the size.

  4. self-assigned this
    on Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions