DataGrid Settings LoadData loop -- resolved (with workaround?)

Hello,

strange thing, i may be doing something wrong here, but here goes...
(Radzen.Blazor v4.3.7, project is WASM)

  • I've implemented basic memory state management as per official MS guidance
  • I put DataGridSettings to the state object
  • I hooked grid's @bind-Settings="@appState.GridSettings"

Now, when I navigate out of grid component and back, state is loaded and grid is on correct page, sorted and all that good stuff. So it's working up to here fine.

But, my grid also specifies PageSize and PageSizeOptions and when I choose another PageSize than the initial one (15 is initial, changed to 30) and navigate out of the component I can inspect app state and I see the new page size. So far so good.

Now, when i return to the component with the grid, and i'm using LoadData to fetching data from API and i'll put breakpoint there I see that first entry's LoadDataArgs argument contains page size of 15, strange, but i'll run it. Second entry's LoadDataArgs contains page size of 30... Third one 15, and so on a so forth. LoadData will get to infinite loop of the initial and saved page size calls.

Also, app state's GridSettings get is getting called a lot, like 5x per grid init. When the loop begins, it get's called 3x per iteration and the page size in the state is 30 the whole time, so it doesn't seems like the state is changed back and forth between 15 and 30.

So... when I manually set PageSize in OnInitialized from the DataGridSettings instance from the app state, then it works and loop is gone. But as i understand it, i shouldn't have to do that...

Also LoadData is still getting called twice, first time with default LoadDataArgs instance and second time with LoadDataArgs with correct values from saved grid settings.

We will investigate this and if there’s something wrong we will provide fix.

1 Like