Open Rosuavio opened 3 years ago
Hello RosarioPulella, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌
Wired issue, we take a pageSize
in the ctor, but also we should be respecting DataFetchSize
from the ListView
that we get threw IncrementalLoadingCollection.LoadMoreItemsAsync(unit count)
.
I can identify three options to resolve this.
pageSize
in the ctor only use the requested count
per request.count
per request. Document it and make the current behavior clearer in Docs or where we can.pageSize
as a max size for each request and fetch the smaller amount of items, count
or pageSize
, per request.@RosarioPulella when we see it being called from the ListView, do we know what the count
value normally seems to come through as?
I seem to have made the incorrect assumption that the DataFetchSize
on the ListView
is directly used. I modified the sample app to have a DataFetchSize
and set up a button to trigger loading more items and I was getting very unexpected numbers coming threw for the count
on IAsyncOperation<LoadMoreItemsResult> LoadMoreItemsAsync(uint count)
.
With DataFetchSize
set to 5
I the count would be 1
on the first request for more items and 57
for every consecutive one.
With DataFetchSize
set to 1
I the count would be 1
on the first request for more items and 11
for every consecutive one.
With DataFetchSize
set to 20
I the count would be 1
on the first request for more items and 229
for every consecutive one.
After reading the docs more closely I see I misunderstood DataFetchSize
"The amount of data to fetch per interval, in pages"
It seems like any notion of a "Page Size" is actually calculated from the amount of the items that can be visible on the list at a time. So that count might come from "Page Size" * DataFetchSize
. I am not sure why the first request comes threw with 1
regardless.
Yeah, the first request always being 1
seems a bit odd. Maybe something we should file an issue about on the WinUI repo?
So the pageSize
is from IIncrementalSource
, but all we're really doing is passing the ItemsPerPage
(default 20 from our constructor) of the IncrementalLoadingCollection
to the source. So ItemsPerPage
is really just a configuration value that the implementer can provide to their own data source.
We just also use that value to pass-thru in LoadDataAsync
:
So, I almost feel like we need to define if we take the greater (or lesser) of count
vs ItemsPerPage
. Maybe that's another setting? Right, do you want to limit your collection to only load a certain amount of items regardless of what the OS is requesting OR do you want to ensure there's a minimum loaded at least but potentially load all the things being requested...
Right?? @azchohfi @vgromfeld @Sergio0694 any thoughts on these scenarios here?
Describe the bug
IncrementalLoadingCollection.LoadMoreItemsAsync(unit count)
ignores count in its implementation. This breaks the contract of theISupportIncrementalLoading.LoadMoreItemsAsync(unit count)
interfaceInstead of loading the requested amount of items, we load a single group of items starting at
IncrementalLoadingCollection.CurrentPageIndex
of sizeIncrementalLoadingCollection.ItemsPerPage
Steps to Reproduce
Steps to reproduce the behavior:
Expected behavior
Three items load into the collection every time the "Test" button is clicked
Screenshots
Environment
Additional context
Add any other context about the problem here.