Awaiting for some time in the ItemsProvider method in the Virtualize component and the user scrolling leads to unpredictable scrolling behaviour #61156
Labels
area-blazor
Includes: Blazor, Razor Components
investigate
Needs: Attention 👋
This issue needs the attention of a contributor, typically because the OP has provided an update.
Milestone
Description
When a user scrolls using the scrollbar in the Virtualize component when awaiting (Task.Delay) is performed in the ItemsProvider method the scrollbar moves unpredictably.
When the awaiting (Task.Delay) is removed when a user scrolls using the scrollbar then the scrollbar moves as expected.
When the awaiting is done it appears to cancel ItemsProvider call via the CancellationToken. Perhaps I am not handling the cancelling request appropriately. Please see the reproduction steps.
Reproduction Steps
Expected behavior
Scrolling with awaiting Task.Delay should not lead to unpredictable scrolling.
Actual behavior
When scrolling with the await occasionally the scrollbar will jump forward and back unpredictably which is not expected. Also notice that the numbered item (which are sequential) will also confirm that it is scrolling unpredictably.
Regression?
I have not tried in previous versions
Known Workarounds
Don't await in the ItemsProvider call, instead return loading items and previously loaded total and use a ContinueWith on the service task and update the items when the service task resolves.
Configuration
.NET 8 windows 11
Other information
I think it is related to how cancelled ItemsProvider requests are handled.
The text was updated successfully, but these errors were encountered: