Repository navigation
Improve QuickGrid diagnostics for mismatched GridSort types - #67413
ilonatommy merged 15 commits into
Conversation
|
Thanks for your PR, @BharatRamsf3693. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Pull request overview
This PR improves QuickGrid’s diagnostics when a column ends up being constructed with a different TGridItem than its parent QuickGrid<TGridItem> (commonly via a mismatched GridSort<TSortItem>), by cascading the grid’s item Type to columns and validating during column registration. It also adds an E2E page and tests covering several mismatch scenarios.
Changes:
- Cascade the grid item type (
typeof(TGridItem)) fromQuickGridto descendant columns. - Validate column
TGridItemvs. grid item type and throw a clearerInvalidOperationExceptionon mismatch. - Add a dedicated test page and E2E tests to assert the improved error output in interactive server mode.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/QuickGrid/QuickGridTypeMismatch.razor | Adds a test page exercising multiple QuickGrid/column type mismatch scenarios via error boundaries. |
| src/Components/test/E2ETest/Tests/QuickGridInteractiveTest.cs | Adds E2E assertions verifying the improved mismatch diagnostics are surfaced to developers. |
| src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor | Cascades the grid item Type to descendants using a named CascadingValue. |
| src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs | Adds a named cascading parameter to receive the grid’s item Type. |
| src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor | Implements the type mismatch validation and throws a clearer exception. |
|
All review comments have been addressed, and the implementation has been further optimized. |
There is a "resolve conversation" button you can use under each review comment to mark that. |
ilonatommy
left a comment
There was a problem hiding this comment.
Public API changes from community PRs are not planned anymore for this release. We can take only internal fixes, otherwise it will wait for .net12.
Thanks for the clarification. The public API changes have been removed. |
ilonatommy
left a comment
There was a problem hiding this comment.
Thank you! The remaining work is a small cleanup, then we can merge.
ilonatommy
left a comment
There was a problem hiding this comment.
@BharatRamsf3693 thank you for your work!
Improve QuickGrid diagnostics for mismatched GridSort types
Description
This change improves the developer experience when a QuickGrid column is configured with a type that does not match the parent
QuickGrid<TGridItem>item type.Previously, a column could fail during initialization with an unclear exception when it could not be associated with its parent grid due to a generic type mismatch. This made the root cause difficult to identify and troubleshoot.
This update introduces explicit validation during column initialization to verify that the column's
TGridItemtype matches the parent grid's item type. When a mismatch is detected, a clear and actionable exception is thrown with guidance for resolving the issue.Before
After
Changes included
ColumnBase<TGridItem>during component initialization.QuickGriditem type.InvalidOperationExceptionwhen a mismatched column attempts to attach to a grid.(unnamed)when not specified.TGridItemtype.QuickGriditem type does not match.Example exception
Fixes #56437