DataGrid settings are not applied after 4.25.12

I have noticed that after updating the Razer Components to 4.25.12 (or newer), the saved grid settings are not applied any more. Reverting back to 4.25.11 fixes the issue.
My code is very similar to the example in the docs Blazor DataGrid Component - Save / Load Settings with LoadData | Free UI Components by Radzen.

I appreciate that the sample works ok. However I cannot figure why settings are not applied any more when using 4.25.12 version whilst it works ok on previous versions.

Looking at the change log I can see the following commit as a potential reason: DataGrid save/load settings will handle composite columns as well · radzenhq/radzen-blazor@e9f74bf · GitHub. It must be that in my case somehow the settingsChanged stays false thus leading to the parameter not being set.

Any help would be much appreciated. Thank you.

This is not the latest version.

I understand that. I am highlighting the version from which I can see a difference in behaviour. 4.25.12 and in any newer it manifests the behaviour I describe.

Let us know how to reproduce this. You can use our demos for reference.

Having done some experiments with my code, it seems that the issue manifests when the DataGrid is hosted within a component which is then hosted in a page. When I place the grid directly in a page it seems to be working OK.

I cannot verify for sure, but this line of code in the DataGrid's codebase added in 4.25.12 seems to be always FASLE when the DataGrid is placed inside another component

case nameof(Settings):
              settingsChanged = HasChanged(parameter.Value, Settings);

Both demos are exactly such setup:

Thank you for you quick replies @enchev.
It is helpful to know that the set up is similar.
As I do not know the reason why this stops working from 4.25.12 onwards, I am trying to identify potential causes. Apologies I cannot be more useful.

One more difference is that in my case I pass the data source from the page into the component that hosts the DataGrid

<CustomDataGrid DataSource=@Data>
 IEnumerable<> Data;
protected override async Task OnInitializedAsync()
    Data = await GenerateSomeData();

and inside the custom component:

<DataGrid Data="@_data">

public IEnumerable<> DataSource { get; set; }

protected override void OnParametersSet()
    if (!_data.Any())
        _data = DataSource;

The data show OK in the grid and all functions of the grid work as normal. It is only the Settings that are not applied and the code I have to handle the settings is literally identical to the samples you have here: Blazor DataGrid Component - Save / Load Settings with LoadData | Free UI Components by Radzen

You can try to debug your application to check why the settings are reported as unchanged in your case.

I am not sure how to do what you recommend.
I load the page, I add/remove some columns, I change the page size and then I refresh the page using the browser's refresh button.
What I see is that the settings are read from the store ("window.localStorage.getItem") correctly as per my changes before I hit the refresh in the browser. However the settings are not reflected on the grid after the page is fully loaded.
To reiterate: this worked ok in 4.25.11

You can attach Radzen.Blazor.csproj to your application instead the nuget package.

I managed to understand a bit more by debugging the way suggested by @enchev. My solution now works OK but I cannot claim I have fixed it. What I have done it seems like I managed to bypass the issue. However I cannot claim it is a bug as I am not yet very confident with my understanding around the page life cycle events especially when child components are involved.

In my previous implementation I had an OnInitializedAsync() on the page where I was fetching the data to bind to the DataGrid. The data were set into a private member which was used as the data source for the custom control that I had in the page that encapsulated the DataGrid. The mere assignment to the private member was not refreshing the DataGrid to show the data so I had a paced a DataGrid.Reload() command into the page's OnAfterRenderAsync()

This combination seems to stumble upon a weird synchronization issue in the lifecycles events where the DataGrid's OnAfterRenderAsync() was called before the DataGrid's SetParametersAsync() got a non null value in the Settings parameter. As the OnAfterRenderAsync() includes a call to the LoadSettings() and that is assigning the Settings internally, it resulted in a case where the SetParametersAsync() when eventually the Settings parameter was not null was comparing it with the already assigned Settings property leading to the settingsChanged always being resulting as false, leading to never executing the LoadSettingsInternal() method resulting to no settings being set on the DataGrid.

I believe this is a weakness inside the Settings management model/code of the control that is worth reviewing. Effectively the parameter for settings should never be provided to the SetParametersAsync() method AFTER the internal Settings property is already set by the internal OnAfterRenderAsync() method. The HasChanged() method only checks referential equality for Settings hence when both the incoming parameter and the Settings property are not null it will return true hence the properties wont be set on the DataGrid.

I solved the issue by moving the data fetching code from my page's OnInitializedAsync() to my page's SetParametersAsync(). Inside it I call the StateHasChanged() as well which allows the DataGrid to refresh. Because of that I could remove the Reload() method call I had inside the page's OnAfterRenderAsync() and all that lead to the problem going away.

I have the same issue after 4.25.12.

However I cannot try your workaround, as I am using LoadData for data binding. I'm going to attempt to make a reproducible example using their demo code

Same thing happened to us, once we update to anything after 4.25.11 all of our grids that used to work perfectly fine stop loading data on initial load. We also use the LoadData binding approach. I thought perhaps waiting a few versions would fix the issue, but even with the latest version grid load event is not fired. It seems to happen when using RadMenuPanel navigation, if I f5 on the page itself the load event is triggered...

Looks like it's related to how we load GridSettings and something must have changed there. Following the demo way to handle Save/Load settings using LoadData (Blazor DataGrid Component - Save / Load Settings with LoadData | Free UI Components by Radzen) seems to work.

Turns out that I was wrong and it just happened to work that one time. So this bothered me and I grabbed the project and included it to walk through. I've found that adding settingsChanged = true; on line 2357 of RadzenDataGrid.razor.cs fixes the issue reliably for me. Looking at it closer it makes sense that settingsChanged is marked as true when the settings are actually loaded and different, but would be great to have somebody look into this further.