Skip to content

Blazor Wasm: Virtualize component making 3 initial calls to ItemsProvider instead of 1 #27065

@bancroftway

Description

@bancroftway

When using Virtualize component with ItemsProvider, I have noticed that the ItemsProvider is always called 3 times on the first render. This may be slightly excessive if we are calling an api inside the ItemsProvider.

As an example, I have a collection of 15000 items. On first render, the Virtualize component made 3 calls into the ItemsProvider:

  1. Request Count=20, Start Index=0
  2. Request Count=21, Start Index=14979 (=15000 - 21)
  3. Request Count=21, Start Index=0

I am guessing that the component is doing this for some initial setup calculations of the scroll bar etc...however, the question is whether these 3 calls can be obviated by a single initial call, or is there a way to specify any additional arguments to the component perform its setup without performing 3 calls into ItemsProvider.

Reproduction is here: https://github.com/bancroftway/blazorissuesrepro/tree/dotnet5vscoll

A small video demo is here: https://www.youtube.com/watch?v=5BnRgZTpO0M

Metadata

Metadata

Assignees

No one assigned

    Labels

    PerfPillar: Technical DebtPriority:2Work that is important, but not critical for the releaseaffected-mostThis issue impacts most of the customersarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-virtualizationThis issue is related to the Blazor Virtualize componentseverity-minorThis label is used by an internal tool

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions