Open touseefbsb opened 5 years ago
This issue has been marked as "Needs: Attention 👋" due to no activity for 7 days. Please triage and assign the issue so the fix can be established.
This issue has been marked as "Needs: Attention 👋" due to no activity for 7 days. Please triage the issue so the fix can be established.
This issue has been marked as "Needs: Attention 👋" due to no activity for 7 days. Please triage the issue so the fix can be established.
This issue has been marked as "Needs: Attention 👋" due to no activity for 7 days. Please triage the issue so the fix can be established.
This issue has been marked as "Needs: Attention 👋" due to no activity for 7 days. Please triage the issue so the fix can be established.
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
pls answer this
I am having same issues too, is there any fix available yet
Hi I solved the issue by adding a small delay in the code. like await Task.Delay(1);
now it is not calling GetPagedItemAsync() until all the data gets loaded.
Here's how I modified the code:
public async Task<IEnumerable<Course>> GetPagedItemsAsync(int pageIndex, int pageSize, CancellationToken cancellationToken = default)
{
string connectionString = GlobalDatabaseConfiguration.Url;
using (MySqlConnection connection = new(connectionString))
{
await connection.OpenAsync();
MySqlCommand command = connection.CreateCommand();
command.CommandText = "SELECT * FROM courses ORDER BY id LIMIT @startIndex, @pageSize";
command.Parameters.AddWithValue("@startIndex", pageIndex * pageSize);
command.Parameters.AddWithValue("@pageSize", pageSize);
using MySqlDataReader reader = (MySqlDataReader)await command.ExecuteReaderAsync();
while (await reader.ReadAsync())
{
Course item = new();
item.Id = reader.GetInt32(0);
item.Name = reader.GetString("name");
items.Add(item);
}
}
//This line fixed the issue
await Task.Delay(1);
var result = (from p in items select p).Skip(pageIndex * pageSize).Take(pageSize);
return result;
}
I hope this will fix the issue, but i don't know why it worked.
Describe the bug
I have a uwp app and I am using Windows Community Toolkit for the Incremental Loading feature on my list. Now the problem I am having it that it keeps calling GetPagedItemsAsync repeatedly without scrolling the list.
Explaination
So on my homepage I have a GridView on top bound to a collection of ModuleConfigurationDto and upon its item being selection I want to show the List of Evidences below the GridView, as each item has its own list of evidences and the selected item should show its list below.
So I used the community toolkit for incremental loading purpose that upon an item being selected it should load first set of items and then only on scrolling it calls the other set of items and so on.
Now the problem I am having it that it keeps calling GetPagedItemsAsync repeatedly even if I return a list with a single item in this method, and if I return an empty list in this method then it doesn't have this issue and UI just remains empty that way.
Steps to Reproduce
Steps to reproduce the behavior:
Expected behavior
GetPagedItemsAsync method should execute only one on first time loading the list and then only when we actually need more items. i.e : scrolling the list.
Environment
Additional context
StackOverflow post : https://stackoverflow.com/questions/57657593/uwp-incremental-loadingkeep-calling-getpageditemasync-infinitely
Update :
Now I tried the exact example from the Windows Community Toolkit Sample App and put a PeopleListView on the lower half of the page, and it is also showing same bug . I have updated the sample app with that code as well, you can see on the bottom half of the page, all 40 people are loaded in 2 times executing of the method without me scrolling it, and when I scroll it it already has all the items so this time it returns 0 items.
if I increase the number of Evidences or people to 200, then for the 1st time it runs the the GetPagedItemAsync 2 times hence getting 40 items and then it stops executing it unless I scroll, so it works as expected only concern is why does it gets me 2 pages the 1st time when it should get me only 1? This is an issue for me because I am getting the data from a webapi so cant call too many useless calls.
if I change pageSize to 2 :
then it seems the method will keep calling itself until it has loaded about 40 items, which is about the double size of what the UI can show i.e : around 18, but interestingly if I change the pageSize to 40
then then method calls itself 2 times hence loading around 80 items.