Closed evandixon closed 1 year ago
Both PageSize and LoadData are used in this demo however LoadData will be called only once: https://blazor.radzen.com/datagrid-loaddata
On that demo, I added Console.WriteLine("Reload called. Stack trace: " + Environment.StackTrace.Replace("\n", "\\n"));
to line 102 at the very top of LoadData, and looking in the console shows that LoadData is indeed being called twice, once from ReloadOnFirstRender and once from PageSizeChanged. It's easier to see when LoadData makes a network call since you can see two distinct network requests.
Hey @evandixon,
I've used the debugger to check the same:
@enchev Turns out there's a race condition with the reload caused by OnPageSizeChanged not being awaited by the setter of PageSize. If the reload works quickly there, ReloadOnFirstRender will see that there's data and not reload. Adding a await Task.Delay(1000);
to the start of LoadData results in ReloadOnFirstRender loading before OnPageSizeChanged completes.
Describe the bug On the first render of a data grid with both a LoadData delegate and a manually specified PageSize, the LoadData delegate is called twice, once by
PagedDataBoundComponent<>.OnPageSizeChanged
and once byPagedDataBoundComponent<>.ReloadOnFirstRender
.To Reproduce Steps to reproduce the behavior:
Expected behavior The initial set of PageSize doesn't trigger a reload when ReloadOnFirstRender is going to trigger a reload