Fluent Data Grid WebAssembly Renderer Issue #3375
-
I came a across an issue with Fluent Data Grid Which Doesn't Render the Grid on Some Cases with WebAssembly Renderer Exception, therefore Diagnosing the issue seems really hard in this case, Seems like NullReferenceException is Thrown on Internal Dictionary of FLuentDataGrid Here's Sample Code <FluentDataGrid Style="width: 100%"
GridTemplateColumns="0.65fr 1fr 0.5fr 0.5fr 1.5fr 1fr 1.5fr 0.8fr"
Items="ProductService.Pagination.Items"/> The Product Service Does Fetch Data from Server and Populate a List which is Passed as IQueryable to FluentDataGrid, I Already Checked Whether Any issues with Fetching Data from Server and Etc.. I do see Data is Fetched Successfully from the Server and List is Populated Successly without Any issues and Additionally i did checked whether their's any Serialization Issue but that wasn't the case as well, on Some Cases, Adding ItemKey to Grid would Fix the issue but not always, Additionally What i found super weird here is my Entity Does Contain a Property Called Version which is Nullable Int32, When i Set that to Null Directly in the Database and Restart the App Again to Load the Data, the FLuent Data Grid Renders Successfully on 90% of the time and All these First Fetched Item Does have Null Value for Version Except the First Item which is the One Reported the in the Above Error. Of course, i did checked whether any serialization issue with Nullable int32 Version Property, it does Populate without any issues. I'm scratching my head over what causing this issue |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
In the By default the grid uses /// <summary>
/// Optionally defines a value for @key on each rendered row. Typically this should be used to specify a
/// unique identifier, such as a primary key value, for each data item.
///
/// This allows the grid to preserve the association between row elements and data items based on their
/// unique identifiers, even when the <typeparamref name="TGridItem"/> instances are replaced by new copies (for
/// example, after a new query against the underlying data store).
///
/// If not set, the @key will be the <typeparamref name="TGridItem"/> instance itself.
/// </summary>
[Parameter]
public Func<TGridItem, object> ItemKey { get; set; } = x => x!; Since no Instead of using the default reference-based key or a nullable field, define ItemKey="product => product.Id" If this suggestion does not work, can you provide a copy/paste code sample that demonstrates the issue or a repo. |
Beta Was this translation helpful? Give feedback.
I have managed to find the Cause of this Issue, It's a Hashcode In-balance issue which never got picked up by Tests and Overriden Equality of Record Type Caused Multiple Hashcode for Single Property,
What's funny is i spent lots of time diagnosing this issue by Trusting the Test Which Never Pickup the Bug in First Place and Even after Fixing the issue the Test Always Passes and Test Doesn't Seem to have Any issues as well, Whatever it is Thanks man for Assistance and @vnbaaij as well
Anyways's this made jump into Internals of Dotnet and Dictionary Impl which i learned a lot about