Add new BitDataGrid component (#12502)#12504
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
ChangesBitDataGrid buildout
BitQuickGrid extraction
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
🟡 Minor comments (18)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cs-12-13 (1)
12-13:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDeterministic claim is broken by
DateTime.TodayLine 29 makes generated data drift day-to-day, so the “reproducible” promise in Line 12 is not true across dates.
Suggested fix
public static List<Product> Generate(int count, int seed = 42) { var rng = new Random(seed); + var baseDate = new DateTime(2024, 1, 1); var categories = Enum.GetValues<Category>(); var list = new List<Product>(count); @@ - ReleaseDate = DateTime.Today.AddDays(-rng.Next(0, 2000)), + ReleaseDate = baseDate.AddDays(-rng.Next(0, 2000)),Also applies to: 29-29
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cs` around lines 12 - 13, The Generate method in the SampleData class claims to be deterministic and reproducible in its summary, but it uses DateTime.Today on line 29 which changes daily and breaks the deterministic guarantee. Replace the DateTime.Today usage with a fixed, seed-based date value that remains consistent regardless of when the method is called. This ensures the data generation is truly reproducible and matches the claim in the method's XML summary comment.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs-223-225 (1)
223-225:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winExample 16 sample is missing the
OnCellDoubleClickhandlerLine 224 wires
OnCellDoubleClick, but the paired C# snippet (Lines 230-231) does not define it.Suggested fix
void OnCellClick(BitDataGridCellEventArgs<Product> e) { /* e.Item, e.ColumnTitle, e.Value */ } +void OnCellDoubleClick(BitDataGridCellEventArgs<Product> e) { /* ... */ } void OnCellContextMenu(BitDataGridCellEventArgs<Product> e) { /* e.Mouse.ClientX / e.Mouse.ClientY */ }Also applies to: 230-231
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs` around lines 223 - 225, The Razor component in Example 16 declares an OnCellDoubleClick event handler in the markup, but the corresponding C# method is missing from the code-behind. Add the OnCellDoubleClick handler method in the C# section of BitDataGridDemo.razor.samples.cs following the same pattern and signature as the existing OnCellClick and OnCellContextMenu handler methods. Ensure the method is defined in the appropriate location within the Example 16 sample code block so it matches the event binding in the markup.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs-148-163 (1)
148-163:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winHonor all sort descriptors in the read handlers.
Both handlers only apply
request.Sorts.FirstOrDefault(), so additional sort descriptors are ignored and multi-sort requests produce incorrect ordering.Suggested fix
- var sort = request.Sorts.FirstOrDefault(); - if (sort is not null) + IOrderedEnumerable<Product>? ordered = null; + foreach (var sort in request.Sorts) { Func<Product, object> key = sort.ColumnId switch { nameof(Product.Name) => p => p.Name, nameof(Product.Category) => p => p.Category, nameof(Product.Supplier) => p => p.Supplier, nameof(Product.Price) => p => p.Price, nameof(Product.Stock) => p => p.Stock, + nameof(Product.Rating) => p => p.Rating, _ => p => p.Id }; - query = sort.Direction == BitDataGridSortDirection.Descending - ? query.OrderByDescending(key) - : query.OrderBy(key); + ordered = ordered is null + ? (sort.Direction == BitDataGridSortDirection.Descending + ? query.OrderByDescending(key) + : query.OrderBy(key)) + : (sort.Direction == BitDataGridSortDirection.Descending + ? ordered.ThenByDescending(key) + : ordered.ThenBy(key)); } + if (ordered is not null) query = ordered;Also applies to: 182-198
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs` around lines 148 - 163, The current implementation only processes the first sort descriptor using request.Sorts.FirstOrDefault(), which causes multi-sort requests to be ignored. Replace the if statement that checks for a single sort with a loop that iterates through all items in request.Sorts collection. For each sort descriptor, apply the appropriate sort operation (OrderBy or OrderByDescending based on sort.Direction) to the query in sequence. The switch statement logic for mapping sort.ColumnId to the appropriate property key should remain the same, but needs to be executed for every sort descriptor in the collection rather than just the first one.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs-203-205 (1)
203-205:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winHandle empty final batches in infinite-scroll status text.
When no rows are returned, the current log renders an inverted range (
start > end), which is misleading.Suggested fix
- var end = request.Skip + batch.Count; - infiniteLog = $"Batch #{infiniteRequests} → loaded rows {request.Skip + 1}–{end} ({batch.Count} rows)"; + if (batch.Count == 0) + { + infiniteLog = $"Batch #{infiniteRequests} → no more rows to load."; + } + else + { + var end = request.Skip + batch.Count; + infiniteLog = $"Batch #{infiniteRequests} → loaded rows {request.Skip + 1}–{end} ({batch.Count} rows)"; + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs` around lines 203 - 205, The infiniteLog message construction does not handle the case when batch.Count is zero (empty final batch), resulting in a misleading inverted range display (e.g., "loaded rows 101–100"). Add a conditional check before assigning to infiniteLog to detect when batch.Count equals zero and either skip the log update entirely or provide an alternative status message that clearly indicates no additional rows were loaded, while preserving the current log message logic for non-empty batches.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cs-126-130 (1)
126-130:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winClear stale accessor when
Fieldis removed.Line 128 sets
Accessoronly whenHasFieldis true; ifFieldchanges from populated to null/empty, the previous accessor remains active.Proposed fix
protected override void OnParametersSet() { if (HasField) Accessor = BitDataGridPropertyAccessor<TItem>.For(Field!); + else + Accessor = null; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cs` around lines 126 - 130, In the OnParametersSet method of the BitDataGridColumn class, the Accessor is only set when HasField is true, but when Field is cleared or removed (HasField becomes false), the previous accessor remains active and is never cleared. Add an else clause after the if (HasField) condition that sets Accessor to null when HasField is false, ensuring stale accessors are properly cleaned up when the Field parameter changes from a value to null or empty.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss-8-8 (1)
8-8:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix Stylelint
value-keyword-caseviolation in font stack.Line 8 currently triggers lint errors; quote named font families so lint passes without changing fallback behavior.
Proposed fix
- --bit-dtg-font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; + --bit-dtg-font: 14px/1.4 system-ui, -apple-system, "Segoe UI", "Roboto", sans-serif;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss` at line 8, The font stack in the --bit-dtg-font custom property on line 8 of BitDataGrid.scss triggers a stylelint value-keyword-case violation because font family names are not properly quoted. Quote all font family names in the font stack (system-ui, -apple-system, Segoe UI, Roboto, and sans-serif) individually in the declaration to ensure stylelint compliance while maintaining the same fallback behavior.Source: Linters/SAST tools
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cs-20-20 (1)
20-20:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
CancellationTokenis never populated by the grid.The
CancellationTokenproperty exists but is never set when constructingBitDataGridReadRequestinstances inLoadNextBatchAsyncorLoadServerDataAsync. Consumers will always receiveCancellationToken.None, making this property ineffective for request cancellation.Consider wiring a
CancellationTokenSourcethat cancels on component disposal or when a new request supersedes an in-flight one.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cs` at line 20, The CancellationToken property in BitDataGridReadRequest is declared but never initialized when instances are created in LoadNextBatchAsync and LoadServerDataAsync methods. To fix this, create a CancellationTokenSource field in the grid component and pass its Token property to the CancellationToken property when constructing each BitDataGridReadRequest instance. Additionally, dispose the previous CancellationTokenSource and create a new one for each request to handle superseding in-flight requests, and ensure the CancellationTokenSource is disposed when the component is disposed to properly clean up resources.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs-557-566 (1)
557-566:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDead code:
|| truemakes!MultiSortineffective.Line 557's condition
(!MultiSort || true)always evaluates totrue, making the!MultiSortcheck dead code. Additionally, line 560 redundantly re-checks!additive.This appears to be leftover from refactoring. Simplify to the intended logic:
🧹 Proposed fix
- if (!additive && (!MultiSort || true)) - { - // Single sort: clear others unless additive - if (!additive) - { - var keep = existing; - _sorts.Clear(); - if (keep is not null) _sorts.Add(keep); - } - } + if (!additive) + { + // Single sort: clear others + var keep = existing; + _sorts.Clear(); + if (keep is not null) _sorts.Add(keep); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs` around lines 557 - 566, The condition in the BitDataGrid.razor.cs sort handling logic contains `|| true` on line 557, which makes the `!MultiSort` check ineffective and represents dead code. Additionally, the inner if statement on line 560 redundantly re-checks the `!additive` condition that was already evaluated in the outer if. To fix this, remove the `|| true` portion from the outer condition so it properly checks both `!additive && !MultiSort`, and remove the redundant inner `if (!additive)` block, moving its contents (the sort clearing logic) to directly execute within the outer if block since the condition already guarantees additive is false.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs-1087-1101 (1)
1087-1101:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winCSV export may throw if
GetFormattedValuereturns null.
GetFormattedValue(item)at line 1094 could potentially returnnull, and passingnulltoEscape()would cause aNullReferenceExceptionon the.Contains()call.🐛 Proposed fix
public string ToCsv() { var cols = VisibleColumns.Where(c => c.HasField).ToList(); var sb = new System.Text.StringBuilder(); sb.AppendLine(string.Join(",", cols.Select(c => Escape(c.DisplayTitle)))); var rows = IsServerMode ? _pageItems : _view; foreach (var item in rows) - sb.AppendLine(string.Join(",", cols.Select(c => Escape(c.GetFormattedValue(item))))); + sb.AppendLine(string.Join(",", cols.Select(c => Escape(c.GetFormattedValue(item) ?? "")))); return sb.ToString(); static string Escape(string v) - => v.Contains(',') || v.Contains('"') || v.Contains('\n') + => v is null ? "" : v.Contains(',') || v.Contains('"') || v.Contains('\n') ? "\"" + v.Replace("\"", "\"\"") + "\"" : v; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs` around lines 1087 - 1101, The ToCsv() method passes the return value of GetFormattedValue(item) directly to the Escape() helper function, but GetFormattedValue can return null, causing a NullReferenceException when Escape tries to call .Contains() on the null value. Fix this by adding null handling to the Escape() method—either at the start of the method by converting null to an empty string using the null coalescing operator, or by using the null coalescing operator when calling GetFormattedValue(item) in the Select expression to ensure Escape always receives a non-null string value.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs-74-84 (1)
74-84:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winReject empty/whitespace paths up front
For("")/For(" ")currently builds an accessor for the entire item object, which silently masks misconfigured columns and leads to incorrect sort/filter behavior.Suggested patch
public static BitDataGridPropertyAccessor<TItem> For(string path) - => Cache.GetOrAdd(path, Build); +{ + if (string.IsNullOrWhiteSpace(path)) + throw new ArgumentException("Property path cannot be null, empty, or whitespace.", nameof(path)); + + return Cache.GetOrAdd(path, Build); +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs` around lines 74 - 84, The For method does not validate the input path parameter before caching and building the accessor. Add validation at the start of the For method to check if the path is null, empty, or contains only whitespace characters. If the path is invalid, throw an appropriate exception to reject the invalid input and prevent the silent masking of misconfigured columns that currently occurs when an empty or whitespace-only path is passed to For.src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor-107-107 (1)
107-107:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix virtualized placeholder
aria-rowindexoffset.Line 107 should account for the header row. Non-virtual rows start at index 2 (Line 54), but placeholders currently start at 1, which misreports row positions to assistive tech.
Suggested fix
- <tr aria-rowindex="@(placeholderContext.Index + 1)"> + <tr aria-rowindex="@(placeholderContext.Index + 2)">🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor` at line 107, The aria-rowindex attribute in the virtualized placeholder row template is not accounting for the header row offset. The placeholder row on line 107 uses placeholderContext.Index + 1, but it should use placeholderContext.Index + 2 to match the offset used in non-virtual rows (which start at index 2 to account for the header). Update the aria-rowindex expression to add 2 instead of 1 to ensure correct row position reporting to assistive technologies.src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss-4-5 (1)
4-5:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRemove
.scssextensions in new imports to satisfy Stylelint.Lines 4-5 currently violate
scss/load-partial-extension.Suggested fix
-@import "../Components/QuickGrid/BitQuickGrid.scss"; -@import "../Components/QuickGrid/Pagination/BitQuickGridPaginator.scss"; +@import "../Components/QuickGrid/BitQuickGrid"; +@import "../Components/QuickGrid/Pagination/BitQuickGridPaginator";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss` around lines 4 - 5, Remove the `.scss` file extensions from the `@import` statements on lines 4-5. Change the imports for BitQuickGrid.scss and BitQuickGridPaginator.scss to remove the `.scss` extension so they reference just the partial names without the extension, which satisfies the scss/load-partial-extension Stylelint rule that disallows explicit file extensions in SCSS imports.Source: Linters/SAST tools
src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs-129-134 (1)
129-134:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winTypo in XML documentation.
Line 131 has a typo: "A callback that supplies data for the rid" should be "A callback that supplies data for the grid".
📝 Proposed fix
/// <summary> - /// A callback that supplies data for the rid. + /// A callback that supplies data for the grid. /// /// You should supply either <see cref="Items"/> or <see cref="ItemsProvider"/>, but not both. /// </summary>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs` around lines 129 - 134, Fix the typo in the XML documentation comment for the ItemsProvider parameter where it currently states "A callback that supplies data for the rid" should be corrected to "A callback that supplies data for the grid". Locate the summary element in the XML comment block preceding the ItemsProvider property declaration and change the word "rid" to "grid" to accurately describe what the callback supplies data for.src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs-346-353 (1)
346-353:⚠️ Potential issue | 🟡 MinorAwait
SetTotalItemCountAsynccalls to ensure exceptions are not swallowed.
Pagination?.SetTotalItemCountAsync(result.TotalItemCount)is not awaited. The method can perform asynchronous work throughTotalItemCountChangedSubscribable.InvokeCallbacksAsync()orSetCurrentPageIndexAsync(), either of which may trigger component updates and can throw exceptions. Without awaiting, any exceptions from these async operations will be silently swallowed. The same pattern appears at line 392.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs` around lines 346 - 353, The SetTotalItemCountAsync method call on the Pagination object is not being awaited, which means any exceptions thrown by async operations within it (such as TotalItemCountChangedSubscribable.InvokeCallbacksAsync or SetCurrentPageIndexAsync) will be silently swallowed. Add the await keyword before the Pagination?.SetTotalItemCountAsync(result.TotalItemCount) call to properly handle exceptions. Apply the same fix to both occurrences of this pattern in the BitQuickGrid.razor.cs file.src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scss-15-16 (1)
15-16:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix transition declaration so the delay is applied.
At Line 15,
transition-delayis overridden by the shorthand on Line 16, so the delay never takes effect.💡 Suggested fix
- transition-delay: 25ms; - transition: opacity linear 100ms; + transition: opacity linear 100ms 25ms;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scss` around lines 15 - 16, The shorthand transition property on line 16 overrides the transition-delay specified on line 15, causing the delay to be lost. Combine both properties into a single shorthand transition declaration that includes the delay value as the fourth parameter: change the two separate lines to a single transition property that specifies opacity, linear, the 100ms duration, and the 25ms delay in the correct order.Source: Linters/SAST tools
src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cs-31-35 (1)
31-35:⚠️ Potential issue | 🟡 MinorUpdate XML documentation generic type references.
The class
BitQuickGridSort<TGridItem>has mismatched generic parameters in four methods' XML documentation. All instances use<see cref="BitQuickGridSort{T}"/>instead of<see cref="BitQuickGridSort{TGridItem}"/>, which will produce unresolved-cref warnings.Apply the following changes to all four methods:
Required fixes
- ByAscending method (lines 31, 35): Replace
BitQuickGridSort{T}withBitQuickGridSort{TGridItem}in both the summary and returns documentation.- ByDescending method (lines 41, 45): Replace
BitQuickGridSort{T}withBitQuickGridSort{TGridItem}in both the summary and returns documentation.- ThenAscending method (lines 51, 55): Replace
BitQuickGridSort{T}withBitQuickGridSort{TGridItem}in both the summary and returns documentation.- ThenDescending method (lines 68, 72): Replace
BitQuickGridSort{T}withBitQuickGridSort{TGridItem}in both the summary and returns documentation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cs` around lines 31 - 35, In the BitQuickGridSort class, update the XML documentation for the four sorting methods (ByAscending, ByDescending, ThenAscending, and ThenDescending) to use the correct generic type parameter. Replace all instances of `BitQuickGridSort{T}` with `BitQuickGridSort{TGridItem}` in the see cref tags within both the summary and returns elements of each method's documentation to match the actual class generic parameter name and resolve cref warnings.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor-20-20 (1)
20-20:⚠️ Potential issue | 🟡 MinorAdd
Relattribute to protect thetarget="_blank"link.BitLink does not automatically apply
rel="noopener noreferrer"for external links. AddRel="BitLinkRels.NoOpener | BitLinkRels.NoReferrer"to prevent opener access:<BitLink Href="https://www.nuget.org/packages/Bit.BlazorUI.Extras" Target="_blank" Rel="BitLinkRels.NoOpener | BitLinkRels.NoReferrer">🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor` at line 20, The BitLink component with Target="_blank" is missing the Rel attribute which is needed for security protection against opener access. Add the Rel attribute to the BitLink component (around line 20) with the value "BitLinkRels.NoOpener | BitLinkRels.NoReferrer" to properly secure the external link. This will prevent the opened page from accessing the window.opener object.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor-101-101 (1)
101-101:⚠️ Potential issue | 🟡 MinorUse distinct
@refvariables for the two product grids.At lines 101 and 116, both
BitQuickGridinstances share the same component reference@ref="productsDataGrid", causing the second grid to overwrite the first. TheODataSampleNameFilterproperty setter (in code-behind) refreshes only the last rendered grid instance, breaking the intended refresh behavior for the virtualized grid.Suggested fix
-<BitQuickGrid `@ref`="productsDataGrid" ItemsProvider="`@productsItemsProvider`" ItemKey="(p => p.Id)" TGridItem="ProductDto" Virtualize> +<BitQuickGrid `@ref`="odataProductsDataGrid" ItemsProvider="`@productsItemsProvider`" ItemKey="(p => p.Id)" TGridItem="ProductDto" Virtualize> -<BitQuickGrid `@ref`="productsDataGrid" ItemsProvider="`@productsItemsProvider`" ItemKey="(p => p.Id)" TGridItem="ProductDto" Pagination="pagination3"> +<BitQuickGrid `@ref`="loadingTemplateProductsDataGrid" ItemsProvider="`@productsItemsProvider`" ItemKey="(p => p.Id)" TGridItem="ProductDto" Pagination="pagination3">Also declare these fields in
BitQuickGridDemo.razor.csand update theODataSampleNameFiltersetter to refresh the correct grid reference.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor` at line 101, The two BitQuickGrid instances in the template are sharing the same `@ref` variable "productsDataGrid", causing the second grid to overwrite the first reference. Create distinct `@ref` variables for each BitQuickGrid component (one for the virtualized grid and one for the other grid), then declare corresponding fields in the BitQuickGridDemo.razor.cs code-behind file for each of these new references. Finally, update the ODataSampleNameFilter property setter to refresh the correct grid instance based on which grid should be updated when the filter changes.
🧹 Nitpick comments (1)
src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs (1)
447-462: 💤 Low valueConsider avoiding repeated
List<string>allocations.
GetRowClassandGetRowStyle(lines 447-479) allocate a newList<string>on every row render. For grids with many rows, this could add GC pressure. Consider using aStringBuilderor direct string concatenation since you're only combining at most two values.♻️ Possible simplification
private string? GetRowClass(TGridItem item) { - var classes = new List<string>(); - - if (RowClass is not null) - { - classes.Add(RowClass); - } - - if (RowClassSelector is not null) - { - classes.Add(RowClassSelector(item)); - } - - return classes.Any() ? string.Join(' ', classes) : null; + var baseClass = RowClass; + var selectorClass = RowClassSelector?.Invoke(item); + + return (baseClass, selectorClass) switch + { + (not null, not null) => $"{baseClass} {selectorClass}", + (not null, null) => baseClass, + (null, not null) => selectorClass, + _ => null + }; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs` around lines 447 - 462, The GetRowClass and GetRowStyle methods allocate a new List<string> on every row render, which creates unnecessary garbage collection pressure when rendering large grids. Replace the List<string> allocation and join pattern with direct string concatenation in both methods. Since you're combining at most two values in each method (RowClass and RowClassSelector for GetRowClass, and similarly for GetRowStyle), you can build the result string directly by checking the conditions and concatenating the values with a space separator only when both values exist, avoiding the List allocation entirely.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Around line 448-475: In the LoadNextBatchAsync method, the OnLoadMore callback
invocation can throw an exception that causes the _infiniteLoading flag to
remain true, permanently blocking further loads. Wrap the entire logic starting
from the OnLoadMore call through the state updates in a try-finally block,
ensuring that _infiniteLoading is set to false and StateHasChanged is called in
the finally clause. This guarantees that _infiniteLoading will be reset even if
OnLoadMore throws an exception, allowing users to recover and retry loading more
data.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs`:
- Around line 144-153: The Sum and Average aggregation calculations in the
BitDataGridDataProcessor class use double type for accumulating values, which
loses precision for decimal/currency columns. Replace the double sum variable
and the TryToDouble method calls with decimal-based logic to preserve numeric
precision. Ensure the accumulation and calculation logic in the Sum case (around
lines 147-152) uses decimal arithmetic throughout, and apply the same fix to the
related aggregation logic mentioned in lines 174-180 to maintain consistency
across all numeric aggregate operations.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs`:
- Around line 95-97: The compiled getter in BitDataGridPropertyAccessor for
nested property paths like Address.City is not null-safe. When an intermediate
property (like Address) is null, the expression throws an exception instead of
returning null. Modify the expression tree construction before creating the
Expression.Lambda to include null checks at each level of the property chain.
This should use Expression.Condition to test if each intermediate property
access is null and return null early if any level is null, allowing sorting and
filtering to handle partial object graphs gracefully without runtime failures.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cs`:
- Around line 7-10: The BitDataGridReadResult constructor accepts `items` and
`totalCount` parameters without validation, which allows null items and negative
totalCount values to pass through and corrupt the grid state. Add argument guard
clauses at the start of the BitDataGridReadResult constructor to validate that
items is not null and totalCount is greater than or equal to zero, throwing
appropriate ArgumentException or ArgumentNullException if validation fails,
ensuring invalid OnRead outputs fail immediately rather than causing downstream
paging issues.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.ts`:
- Line 47: The call to colOptions.scrollIntoViewIfNeeded() is using a
non-standard browser API that is not supported in Firefox and will cause runtime
errors. Replace this single method call with a check that first tests if the
method exists before calling it, and falls back to the standard scrollIntoView()
API if scrollIntoViewIfNeeded is not available. This ensures the column-options
interaction works across all browsers including Firefox.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor`:
- Around line 108-110: The icon-only buttons with class "bit-qkg-cob" that
trigger Grid.ShowColumnOptions(this) at lines 110 and 129 lack accessible names,
making them unannounced to assistive technologies. Add an aria-label attribute
to both button elements that provides a descriptive name for the column options
button (such as "Column options" or similar descriptive text). This ensures
screen readers will properly announce the button's purpose to users with
disabilities.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cs`:
- Around line 657-660: In the code where the OData filter string is constructed
using the query.Add method, the user input from _odataSampleNameFilter is being
directly interpolated without escaping, which creates an OData injection
vulnerability. To fix this, before interpolating _odataSampleNameFilter into the
filter string literal, escape any single quotes in the user input by replacing
each single quote character with two consecutive single quotes, as required by
the OData specification. This ensures that user input containing single quotes
like test' or '1'='1 will be treated as literal string data rather than being
able to break out of or modify the filter expression.
- Line 669: In the productsItemsProvider method at the GetFromJsonAsync call on
line 669, add the cancellation token parameter req.CancellationToken as the
third argument to match the pattern already established in the
foodRecallItemsProvider method. This will ensure the HTTP request can properly
respond to cancellation requests from the grid.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scss`:
- Line 12: The stylelint rule `selector-pseudo-element-no-unknown` flags
`::deep` pseudo-elements at lines 12, 62, 89, and 122 in the
BitQuickGridDemo.razor.scss file because `::deep` is a Blazor-specific
pseudo-element not part of standard CSS. Fix this by adding
`"selector-pseudo-element-no-unknown": null` to the rules section in
`.stylelintrc.json` to globally disable this rule (recommended approach), or
alternatively wrap each `::deep` block with stylelint disable and re-enable
comments (/* stylelint-disable-next-line selector-pseudo-element-no-unknown */
before and /* stylelint-enable */ after) if a file-local approach is preferred.
---
Minor comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Around line 557-566: The condition in the BitDataGrid.razor.cs sort handling
logic contains `|| true` on line 557, which makes the `!MultiSort` check
ineffective and represents dead code. Additionally, the inner if statement on
line 560 redundantly re-checks the `!additive` condition that was already
evaluated in the outer if. To fix this, remove the `|| true` portion from the
outer condition so it properly checks both `!additive && !MultiSort`, and remove
the redundant inner `if (!additive)` block, moving its contents (the sort
clearing logic) to directly execute within the outer if block since the
condition already guarantees additive is false.
- Around line 1087-1101: The ToCsv() method passes the return value of
GetFormattedValue(item) directly to the Escape() helper function, but
GetFormattedValue can return null, causing a NullReferenceException when Escape
tries to call .Contains() on the null value. Fix this by adding null handling to
the Escape() method—either at the start of the method by converting null to an
empty string using the null coalescing operator, or by using the null coalescing
operator when calling GetFormattedValue(item) in the Select expression to ensure
Escape always receives a non-null string value.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss`:
- Line 8: The font stack in the --bit-dtg-font custom property on line 8 of
BitDataGrid.scss triggers a stylelint value-keyword-case violation because font
family names are not properly quoted. Quote all font family names in the font
stack (system-ui, -apple-system, Segoe UI, Roboto, and sans-serif) individually
in the declaration to ensure stylelint compliance while maintaining the same
fallback behavior.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cs`:
- Around line 126-130: In the OnParametersSet method of the BitDataGridColumn
class, the Accessor is only set when HasField is true, but when Field is cleared
or removed (HasField becomes false), the previous accessor remains active and is
never cleared. Add an else clause after the if (HasField) condition that sets
Accessor to null when HasField is false, ensuring stale accessors are properly
cleaned up when the Field parameter changes from a value to null or empty.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs`:
- Around line 74-84: The For method does not validate the input path parameter
before caching and building the accessor. Add validation at the start of the For
method to check if the path is null, empty, or contains only whitespace
characters. If the path is invalid, throw an appropriate exception to reject the
invalid input and prevent the silent masking of misconfigured columns that
currently occurs when an empty or whitespace-only path is passed to For.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cs`:
- Line 20: The CancellationToken property in BitDataGridReadRequest is declared
but never initialized when instances are created in LoadNextBatchAsync and
LoadServerDataAsync methods. To fix this, create a CancellationTokenSource field
in the grid component and pass its Token property to the CancellationToken
property when constructing each BitDataGridReadRequest instance. Additionally,
dispose the previous CancellationTokenSource and create a new one for each
request to handle superseding in-flight requests, and ensure the
CancellationTokenSource is disposed when the component is disposed to properly
clean up resources.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor`:
- Line 107: The aria-rowindex attribute in the virtualized placeholder row
template is not accounting for the header row offset. The placeholder row on
line 107 uses placeholderContext.Index + 1, but it should use
placeholderContext.Index + 2 to match the offset used in non-virtual rows (which
start at index 2 to account for the header). Update the aria-rowindex expression
to add 2 instead of 1 to ensure correct row position reporting to assistive
technologies.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 129-134: Fix the typo in the XML documentation comment for the
ItemsProvider parameter where it currently states "A callback that supplies data
for the rid" should be corrected to "A callback that supplies data for the
grid". Locate the summary element in the XML comment block preceding the
ItemsProvider property declaration and change the word "rid" to "grid" to
accurately describe what the callback supplies data for.
- Around line 346-353: The SetTotalItemCountAsync method call on the Pagination
object is not being awaited, which means any exceptions thrown by async
operations within it (such as
TotalItemCountChangedSubscribable.InvokeCallbacksAsync or
SetCurrentPageIndexAsync) will be silently swallowed. Add the await keyword
before the Pagination?.SetTotalItemCountAsync(result.TotalItemCount) call to
properly handle exceptions. Apply the same fix to both occurrences of this
pattern in the BitQuickGrid.razor.cs file.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scss`:
- Around line 15-16: The shorthand transition property on line 16 overrides the
transition-delay specified on line 15, causing the delay to be lost. Combine
both properties into a single shorthand transition declaration that includes the
delay value as the fourth parameter: change the two separate lines to a single
transition property that specifies opacity, linear, the 100ms duration, and the
25ms delay in the correct order.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cs`:
- Around line 31-35: In the BitQuickGridSort class, update the XML documentation
for the four sorting methods (ByAscending, ByDescending, ThenAscending, and
ThenDescending) to use the correct generic type parameter. Replace all instances
of `BitQuickGridSort{T}` with `BitQuickGridSort{TGridItem}` in the see cref tags
within both the summary and returns elements of each method's documentation to
match the actual class generic parameter name and resolve cref warnings.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss`:
- Around line 4-5: Remove the `.scss` file extensions from the `@import`
statements on lines 4-5. Change the imports for BitQuickGrid.scss and
BitQuickGridPaginator.scss to remove the `.scss` extension so they reference
just the partial names without the extension, which satisfies the
scss/load-partial-extension Stylelint rule that disallows explicit file
extensions in SCSS imports.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 148-163: The current implementation only processes the first sort
descriptor using request.Sorts.FirstOrDefault(), which causes multi-sort
requests to be ignored. Replace the if statement that checks for a single sort
with a loop that iterates through all items in request.Sorts collection. For
each sort descriptor, apply the appropriate sort operation (OrderBy or
OrderByDescending based on sort.Direction) to the query in sequence. The switch
statement logic for mapping sort.ColumnId to the appropriate property key should
remain the same, but needs to be executed for every sort descriptor in the
collection rather than just the first one.
- Around line 203-205: The infiniteLog message construction does not handle the
case when batch.Count is zero (empty final batch), resulting in a misleading
inverted range display (e.g., "loaded rows 101–100"). Add a conditional check
before assigning to infiniteLog to detect when batch.Count equals zero and
either skip the log update entirely or provide an alternative status message
that clearly indicates no additional rows were loaded, while preserving the
current log message logic for non-empty batches.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs`:
- Around line 223-225: The Razor component in Example 16 declares an
OnCellDoubleClick event handler in the markup, but the corresponding C# method
is missing from the code-behind. Add the OnCellDoubleClick handler method in the
C# section of BitDataGridDemo.razor.samples.cs following the same pattern and
signature as the existing OnCellClick and OnCellContextMenu handler methods.
Ensure the method is defined in the appropriate location within the Example 16
sample code block so it matches the event binding in the markup.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cs`:
- Around line 12-13: The Generate method in the SampleData class claims to be
deterministic and reproducible in its summary, but it uses DateTime.Today on
line 29 which changes daily and breaks the deterministic guarantee. Replace the
DateTime.Today usage with a fixed, seed-based date value that remains consistent
regardless of when the method is called. This ensures the data generation is
truly reproducible and matches the claim in the method's XML summary comment.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor`:
- Line 20: The BitLink component with Target="_blank" is missing the Rel
attribute which is needed for security protection against opener access. Add the
Rel attribute to the BitLink component (around line 20) with the value
"BitLinkRels.NoOpener | BitLinkRels.NoReferrer" to properly secure the external
link. This will prevent the opened page from accessing the window.opener object.
- Line 101: The two BitQuickGrid instances in the template are sharing the same
`@ref` variable "productsDataGrid", causing the second grid to overwrite the first
reference. Create distinct `@ref` variables for each BitQuickGrid component (one
for the virtualized grid and one for the other grid), then declare corresponding
fields in the BitQuickGridDemo.razor.cs code-behind file for each of these new
references. Finally, update the ODataSampleNameFilter property setter to refresh
the correct grid instance based on which grid should be updated when the filter
changes.
---
Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 447-462: The GetRowClass and GetRowStyle methods allocate a new
List<string> on every row render, which creates unnecessary garbage collection
pressure when rendering large grids. Replace the List<string> allocation and
join pattern with direct string concatenation in both methods. Since you're
combining at most two values in each method (RowClass and RowClassSelector for
GetRowClass, and similarly for GetRowStyle), you can build the result string
directly by checking the conditions and concatenating the values with a space
separator only when both values exist, avoiding the List allocation entirely.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7038154f-12e2-424f-a8d9-7750b95219c1
📒 Files selected for processing (86)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (5)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 15
🧹 Nitpick comments (5)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss (1)
218-227: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winRespect reduced-motion user preference for spinner/shimmer animations.
The grid always animates loading indicators. Add a
prefers-reduced-motionfallback so motion-sensitive users are not forced into continuous animation.Suggested fix
`@keyframes` bit-dtg-spin { to { transform: rotate(360deg); } } @@ `@keyframes` bit-dtg-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } } + +@media (prefers-reduced-motion: reduce) { + .bit-dtg-spinner, + .bit-dtg-skeleton { + animation: none; + } +}Also applies to: 231-243
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss` around lines 218 - 227, The BitDataGrid spinner and shimmer animations do not respect user accessibility preferences for reduced motion. Wrap the animation properties in the `.bit-dtg-spinner` rule and the related animation rules (lines 231-243) in a `@media (prefers-reduced-motion: no-preference)` query so animations only play for users who have not requested reduced motion. For users with `prefers-reduced-motion: reduce`, provide fallback styles that disable the animation property, ensuring the spinner/shimmer elements remain visible but static.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor (2)
265-270: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winAdd
@keyto virtualized row for identity consistency.The infinite (line 246) and paged (line 275) render paths use
@key="item", but the virtualized path does not. Adding@keyensures consistent item identity tracking across all rendering modes, which helps Blazor optimize DOM updates when items are reordered or modified.♻️ Suggested fix
else if (UseVirtualization) { <Virtualize Items="VirtualRows" ItemSize="RowHeight" Context="item" TItem="TItem"> - <BitDataGridRow TItem="TItem" Grid="this" Item="item" /> + <BitDataGridRow TItem="TItem" Grid="this" Item="item" `@key`="item" /> </Virtualize> }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 265 - 270, The virtualized rendering path in the UseVirtualization condition is missing the `@key` directive on the BitDataGridRow component, while the infinite and paged rendering paths both include `@key`="item". Add `@key`="item" to the BitDataGridRow component inside the Virtualize block to ensure consistent item identity tracking across all rendering modes and allow Blazor to properly optimize DOM updates when items are reordered or modified.
336-338: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winCache
VirtualRowsto avoid repeated list allocation.
VirtualRowscallsToList()on every access when_viewis not anICollection<TItem>. SinceVirtualizemay accessItemsmultiple times during rendering, this creates unnecessary allocations. Consider caching the list when the view changes instead of computing it on each access.♻️ Suggested approach
Add a cached field that is populated when
_viewchanges (e.g., inProcessClientDataorRefreshAsync):// In code-behind private ICollection<TItem>? _cachedVirtualRows; // Update when _view changes _cachedVirtualRows = _view as ICollection<TItem> ?? _view.ToList();Then in the Razor:
-private ICollection<TItem> VirtualRows => _view as ICollection<TItem> ?? _view.ToList(); +private ICollection<TItem> VirtualRows => _cachedVirtualRows ?? [];🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 336 - 338, The VirtualRows property currently calls ToList() on every access when _view is not an ICollection<TItem>, causing repeated allocations during rendering cycles. Add a private cached field to store the computed virtual rows collection, then populate this cache whenever _view changes (such as in ProcessClientData or RefreshAsync methods). Update the VirtualRows property to return the cached field instead of computing the collection on each access, ensuring the cache remains synchronized whenever the underlying _view is modified.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs (1)
220-222: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider caching
VisibleColumnsto avoid repeated allocations.
VisibleColumnscreates a new list on every property access via.ToList(). This property is accessed frequently during rendering (inBitDataGridRow, keyboard navigation, column spanning, etc.). Consider caching the result and invalidating when columns change.♻️ Suggested caching pattern
+ private IReadOnlyList<BitDataGridColumn<TItem>>? _visibleColumnsCache; + private int _columnsVersion; - internal IReadOnlyList<BitDataGridColumn<TItem>> VisibleColumns => _columns.Where(c => c.Visible).ToList(); + internal IReadOnlyList<BitDataGridColumn<TItem>> VisibleColumns => _visibleColumnsCache ??= _columns.Where(c => c.Visible).ToList(); internal void AddColumn(BitDataGridColumn<TItem> column) { if (_columns.Contains(column)) return; _columns.Add(column); _columnsById[column.Id] = column; + _visibleColumnsCache = null; InvokeAsync(StateHasChanged); } internal void RemoveColumn(BitDataGridColumn<TItem> column) { if (_columns.Remove(column)) { _columnsById.Remove(column.Id); + _visibleColumnsCache = null; InvokeAsync(StateHasChanged); } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs` around lines 220 - 222, The VisibleColumns property in the BitDataGrid class creates a new list on every access via .ToList(), causing unnecessary allocations since this property is accessed frequently during rendering. Implement caching by creating a private backing field to store the visible columns list, update this cached list whenever the underlying _columns collection changes (add invalidation logic in methods that modify _columns such as column add/remove operations), and modify the VisibleColumns property to return the cached list instead of recomputing it with .Where().ToList() on each access. Ensure the cache is refreshed whenever columns are added, removed, or their visibility changes.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cs (1)
1-26: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueEvent args exposes mutable
Columnreference; document stability assumption.The
Columnproperty holds a mutable reference toBitDataGridColumn<TItem>. While event args should ideally be immutable snapshots, this design is acceptable in the Blazor component context—columns are stable objects throughout the grid's lifetime. However, for future maintainers, consider adding an inline comment documenting this assumption so any refactoring (e.g., if columns become dynamically mutated) surfaces the design risk.Alternatively, if column mutability becomes a concern, capture immutable column metadata (Id, DisplayTitle) directly into the event args instead of the Column reference itself.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cs` around lines 1 - 26, The `Column` property in the `BitDataGridCellEventArgs<TItem>` class holds a mutable reference to a `BitDataGridColumn<TItem>` object, which violates the principle that event args should be immutable snapshots. Add an inline XML comment above the `Column` property that documents the design assumption that column objects remain stable throughout the grid's lifetime and warns future maintainers about the refactoring risk if columns become dynamically mutated. Alternatively, if mutable column objects become a concern, refactor the event args to capture only the immutable column metadata directly (such as `Id` and `DisplayTitle`) instead of holding a reference to the entire mutable Column object.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 10-33: The dispose method only removes the scroll event listener,
but the setTimeout on line 28 and requestAnimationFrame on line 22 can schedule
the check function to execute after disposal, causing the
dotNetRef.invokeMethodAsync call on line 15 to run on a disposed component and
trigger unhandled rejections. Add a disposed flag that is set to true in the
dispose function, then guard the check function to return early if disposed
before calling dotNetRef.invokeMethodAsync, ensuring no interop calls occur
after the component has been cleaned up.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs`:
- Around line 87-90: The Path property in BitDataGridGroup is being constructed
using keyText, which is a formatted display value from
column.FormatValue(g.Key). This can cause path collisions when different keys
produce identical display values, leading to incorrect collapse/expand state
reuse. Change the path construction on line 89 to use the actual key value g.Key
instead of the formatted keyText when building the path identifier, while
keeping keyText available for display purposes elsewhere.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs`:
- Around line 115-124: The setter construction in the nested property handling
(around the Expression.Assign call in the setter creation block) does not
include null checks for intermediate properties in the chain, unlike the getter
which safely handles nulls. Add null-guard checks in the expression tree to
verify that intermediate properties are not null before attempting to assign to
nested properties. This should prevent SetValue from throwing exceptions when
intermediate nodes in the property path are null.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cs`:
- Around line 8-9: The Priority property in BitDataGridSortDescriptor class has
no default value, causing it to default to 0 in C#. Since the documentation
states "1 = primary" and the sorting logic uses ascending Priority values, a
default of 0 makes unset descriptors become higher priority than those
explicitly set to 1, contradicting the documented behavior. Assign a default
value to the Priority property (consider using int.MaxValue or another
appropriate high value) so that explicitly set priorities take precedence over
uninitialized descriptors and align with the documented sort precedence where 1
is primary.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 373-377: The count calculation on line 376 within the Pagination
null check in the BitQuickGrid class can produce negative values when
request.StartIndex exceeds the remaining items in the page window, which then
causes invalid negative arguments to be passed to Take() method calls downstream
around lines 416-419. Modify the count assignment to clamp the result to a
minimum of zero by wrapping the subtraction expression with Math.Max(0, ...) to
ensure count is never negative, preventing the negative Take argument issue.
- Around line 327-337: The `_pendingDataLoadCancellationTokenSource`
CancellationTokenSource instances are not being properly disposed, causing
resource leaks on frequent refreshes. When canceling the previous token source
at the start of the method and when setting the field to null (in both the
Virtualize branch and the other branch referenced at line 346-352), you must
explicitly dispose each replaced instance before assigning a new one or clearing
the field. Ensure that any old CancellationTokenSource is disposed immediately
after Cancel is called, and dispose the current instance before setting it to
null.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scss`:
- Around line 68-69: The border-inline-start property on line 69 uses a
hardcoded black color instead of the theme token variable used on line 68 for
border-color. Replace the hardcoded black value in the border-inline-start
property with the same theme variable (--bit-clr-brd-pri) to ensure the
resize-handle border color is consistent with the theme and follows the same
design token pattern.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.ts`:
- Around line 41-45: The transform style on colOptions is only set when overhang
exists in the if block, but when the popup is opened again without overhang, the
previous transform value persists and causes misalignment. Add an else clause
after the overhang check to explicitly clear the transform by setting
colOptions.style.transform to an empty string or "none" when neither
leftOverhang nor rightOverhang is true.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs`:
- Line 36: The InvalidOperationException thrown in the
AsyncQueryExecutorSupplier class references a non-existent package
Microsoft.AspNetCore.Components.BitQuickGrid.EntityFrameworkAdapter and method
AddBitQuickGridEntityFrameworkAdapter that do not exist in the codebase. Update
the exception message to instead reference the actual correct approach using the
IAsyncQueryExecutor abstraction that is mentioned in the existing comments,
providing clear guidance on how developers should implement a custom query
executor to handle Entity Framework queries properly. Ensure the updated message
includes actionable steps or references to documentation so developers can
resolve the issue.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss`:
- Around line 4-5: Remove the .scss file extensions from the two import
statements in the extra-components.scss file. The imports for BitQuickGrid and
BitQuickGridPaginator should reference the files without the .scss extension
(e.g., change `@import` "../Components/QuickGrid/BitQuickGrid.scss" to `@import`
"../Components/QuickGrid/BitQuickGrid"). This will comply with the
scss/load-partial-extension stylelint rule.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs`:
- Around line 331-344: The LoadData sample in the filtering and sorting sections
always applies operations to the Name property regardless of which column was
actually requested. Modify the filtering loop to check the field/column name
from the filter request (likely available as a property on the filter object)
and conditionally apply the Contains filter to the appropriate property (Name,
Id, or Price). Similarly, update the sorting section to check which column is
being sorted from the sort request object and apply OrderBy or OrderByDescending
to the correct property instead of always using Name.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor`:
- Around line 164-166: The BitButton component used for the row expand/collapse
toggle lacks an accessible label for assistive technologies. Add an
accessibility attribute (such as AriaLabel or Title) to the BitButton element
that contains the ChevronDown/ChevronRight icon. The label should clearly
describe the button's purpose, such as indicating whether it will expand or
collapse the row details, and should update dynamically based on the same
condition used to toggle the IconName property
(expandedRowTemplateCodes.Contains(context.Code)).
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cs`:
- Around line 68-69: The Description strings in the BitQuickGridDemo class
contain user-facing typos at multiple locations. On line 68, the word "rid"
should be corrected to "grid" in the description text. Additionally, fix any
other grammar or wording errors in the Description properties at lines 160 and
254. Review each Description string for clarity and ensure they are properly
formatted for documentation display purposes.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cs`:
- Around line 726-729: The OData filter query being constructed in the query.Add
call with the contains function is vulnerable to syntax errors when
_odataSampleNameFilter contains single quotes. Escape the user input value by
applying Replace("'", "''") to _odataSampleNameFilter before interpolating it
into the OData filter string. This will properly escape single quotes according
to OData standards and prevent filter syntax breakage.
- Line 738: The GetFromJsonAsync method calls in the sample code are missing the
cancellation token parameter. Add req.CancellationToken as a parameter to both
GetFromJsonAsync calls at lines 738 and 906 to ensure proper cancellation
propagation, making the sample code consistent with the runtime demo provider
implementation.
---
Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`:
- Around line 265-270: The virtualized rendering path in the UseVirtualization
condition is missing the `@key` directive on the BitDataGridRow component, while
the infinite and paged rendering paths both include `@key`="item". Add `@key`="item"
to the BitDataGridRow component inside the Virtualize block to ensure consistent
item identity tracking across all rendering modes and allow Blazor to properly
optimize DOM updates when items are reordered or modified.
- Around line 336-338: The VirtualRows property currently calls ToList() on
every access when _view is not an ICollection<TItem>, causing repeated
allocations during rendering cycles. Add a private cached field to store the
computed virtual rows collection, then populate this cache whenever _view
changes (such as in ProcessClientData or RefreshAsync methods). Update the
VirtualRows property to return the cached field instead of computing the
collection on each access, ensuring the cache remains synchronized whenever the
underlying _view is modified.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Around line 220-222: The VisibleColumns property in the BitDataGrid class
creates a new list on every access via .ToList(), causing unnecessary
allocations since this property is accessed frequently during rendering.
Implement caching by creating a private backing field to store the visible
columns list, update this cached list whenever the underlying _columns
collection changes (add invalidation logic in methods that modify _columns such
as column add/remove operations), and modify the VisibleColumns property to
return the cached list instead of recomputing it with .Where().ToList() on each
access. Ensure the cache is refreshed whenever columns are added, removed, or
their visibility changes.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss`:
- Around line 218-227: The BitDataGrid spinner and shimmer animations do not
respect user accessibility preferences for reduced motion. Wrap the animation
properties in the `.bit-dtg-spinner` rule and the related animation rules (lines
231-243) in a `@media (prefers-reduced-motion: no-preference)` query so
animations only play for users who have not requested reduced motion. For users
with `prefers-reduced-motion: reduce`, provide fallback styles that disable the
animation property, ensuring the spinner/shimmer elements remain visible but
static.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cs`:
- Around line 1-26: The `Column` property in the
`BitDataGridCellEventArgs<TItem>` class holds a mutable reference to a
`BitDataGridColumn<TItem>` object, which violates the principle that event args
should be immutable snapshots. Add an inline XML comment above the `Column`
property that documents the design assumption that column objects remain stable
throughout the grid's lifetime and warns future maintainers about the
refactoring risk if columns become dynamically mutated. Alternatively, if
mutable column objects become a concern, refactor the event args to capture only
the immutable column metadata directly (such as `Id` and `DisplayTitle`) instead
of holding a reference to the entire mutable Column object.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 908cae7a-5590-47b0-bff5-7de18c8d32e9
📒 Files selected for processing (86)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (6)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 11
♻️ Duplicate comments (1)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs (1)
89-92:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse a typed, culture-invariant identity for group path keys.
Line 91 still relies on string interpolation of
g.Key, which can collide when distinct keys produce identical text and causes incorrect collapse/expand state reuse.Suggested fix
var keyText = column.FormatValue(g.Key); var items = g.ToList(); // Use the raw key (not the formatted display text) for the path identifier so that // distinct keys producing identical display values don't collide and share collapse/expand state. - var path = $"{parentPath}/{level}:{g.Key}"; + var keyIdentity = g.Key is null + ? "null" + : g.Key is IFormattable f + ? $"{g.Key.GetType().FullName}:{f.ToString(null, CultureInfo.InvariantCulture)}" + : $"{g.Key.GetType().FullName}:{g.Key}"; + var path = $"{parentPath}/{level}:{descriptor.ColumnId}:{keyIdentity}";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs` around lines 89 - 92, In the BitDataGridDataProcessor.cs file where the path variable is constructed using string interpolation with g.Key, replace the simple string concatenation of g.Key with a typed, culture-invariant identifier that prevents collisions between distinct keys producing identical text. Instead of relying on the string representation of g.Key which can be culture-dependent and cause identical display values to collide, use a robust uniqueness mechanism such as the key's hash code or another unique type-safe identifier that preserves the actual key identity across different key instances.
🧹 Nitpick comments (2)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cs (1)
9-9: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winConsider making
FormattedValuerequired or nullable for consistency.The
FormattedValueproperty has a default value ofstring.Emptybut is not marked asrequired, whileColumnIdis required. This creates an inconsistent initialization pattern. IfFormattedValueis always expected to have a value, mark itrequired; if it's truly optional, consider making itstring?with anulldefault instead.♻️ Proposed options
Option 1: Make it required
- public string FormattedValue { get; init; } = string.Empty; + public required string FormattedValue { get; init; }Option 2: Make it nullable
- public string FormattedValue { get; init; } = string.Empty; + public string? FormattedValue { get; init; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cs` at line 9, The `FormattedValue` property in the `BitDataGridAggregateResult` class has a default value of `string.Empty` but is not marked as `required`, creating an inconsistency with the `ColumnId` property which is required. To fix this, either mark `FormattedValue` as `required` to match the pattern of `ColumnId`, or change its type to `string?` and set the default value to `null` to properly represent it as an optional nullable property. Choose the approach that best represents the semantic intent of this property in your data model.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cs (1)
25-25: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winInconsistent use of
requiredmodifier.The
ValueandMouseproperties are not marked asrequired, but based on the construction code inBitDataGrid.razor.cs:947, they are always explicitly set:new() { Item = item, Column = column, Value = column.GetValue(item), Mouse = e }This is inconsistent with
ItemandColumnbeing markedrequired. Either markValueandMouseasrequiredfor consistency and compile-time safety, or document why they are intentionally optional.♻️ Proposed fix for consistency
/// <summary>The raw value of the cell.</summary> - public object? Value { get; init; } + public required object? Value { get; init; } /// <summary>The underlying browser mouse event.</summary> - public MouseEventArgs Mouse { get; init; } = new(); + public required MouseEventArgs Mouse { get; init; }Also applies to: 28-28
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cs` at line 25, The BitDataGridCellEventArgs class has inconsistent use of the required modifier. The Value property at line 25 and Mouse property at line 28 are not marked as required, while Item and Column properties are. Since the construction code in BitDataGrid.razor.cs always explicitly sets all four properties when creating new instances, either add the required modifier to the Value and Mouse properties to match Item and Column for consistency and compile-time safety, or add documentation comments explaining why these two properties are intentionally optional despite always being set during construction.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Around line 161-162: The _selected HashSet stores TItem references, but when
items are refreshed from server or through infinite scrolling, new object
instances are created with the same key value. Since reference equality fails
for these new instances, previously selected rows appear unselected and
select-all state becomes incorrect. Change the selection mechanism to track
items by their KeyField value instead of object reference. This means either
storing the key values in the _selected collection instead of TItem instances,
or implementing a custom equality comparer for TItem that compares based on the
KeyField value. Apply the same fix to _expandedDetails which has the same issue
at lines 227-230 and 697-715.
- Around line 458-478: The LoadNextBatchAsync method has a race condition where
older OnLoadMore responses can still mutate state after newer requests are
initiated, causing stale data. Implement a version-guard pattern by tracking the
current request version before calling OnLoadMore (similar to how
ResetLoadCancellation is used), then verify this version matches the current
state before applying the response mutations to _infiniteItems, _view,
_pageItems, and _footerAggregates. Apply the same version-guard pattern to both
the LoadNextBatchAsync method shown in the diff and the other similar location
mentioned in the comment (lines 543-557).
- Around line 1137-1139: The ReorderStickyStyle, DetailStickyStyle, and
SelectStickyStyle properties hardcode "left:" for positioning but should use
"right:" when the page is in RTL (right-to-left) mode. Modify each of these
three property definitions to conditionally output either "left:" or "right:"
based on the current RTL state, similar to how the FrozenStyle property handles
directional positioning. Check the BitDataGrid component for any existing RTL
detection logic or boolean flag you can use to determine when to use "right:"
instead of "left:".
- Around line 581-587: The condition on line 581 in the sort-clearing logic uses
`if (!additive && !MultiSort)` which requires both conditions to be true, but
this causes existing sorts to persist when MultiSort=true and a non-additive
click occurs (without Ctrl/Meta). The fix is to change the condition to only
check `if (!additive)` so that prior sorts are cleared whenever it is a
non-additive action, regardless of the MultiSort setting, making the behavior
consistent with Line 393 where additive mode is tied to Ctrl/Meta detection.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razor`:
- Around line 38-45: The column spanning logic in BitDataGridRow.razor skips
rendering columns when span is greater than 1, but the keyboard focus and
navigation model still operates using the full VisibleColumns index space,
creating a mismatch where focus targets can point to non-existent cells. Update
the focus/navigation model to map column indices to account for spanned columns,
ensuring that when columns are skipped due to spanning in the rendering loop
(where skip is decremented and columns are skipped), the corresponding focus
targets and tabindex assignments properly exclude those skipped column indices
so that keyboard focus always lands on a valid rendered BitDataGridCell with
tabindex=0.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 374-381: The Task.Delay(100) call in the debounce logic does not
respect the cancellation token, causing unnecessary delays even when virtualized
requests have already been canceled. Pass the request.CancellationToken as a
parameter to Task.Delay so the delay can be interrupted early if cancellation is
requested. Change Task.Delay(100) to Task.Delay(100, request.CancellationToken)
in the debounce section to make the delay cancellation-aware.
- Around line 324-366: In the RefreshDataCoreAsync method, wrap the call to
ResolveItemsRequestAsync(request) in a try-catch block to explicitly handle
OperationCanceledException. When this exception is caught, it indicates the load
was superseded by a newer request, so ensure the cleanup logic (checking if this
load is still current and disposing the cancellation token source) still
executes properly before allowing the method to complete gracefully without
propagating the exception. This prevents noisy failures during rapid sort/page
refreshes and keeps the load-state cleanup paths robust.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.ts`:
- Around line 83-87: The column resize logic does not enforce a minimum width
constraint on the nextWidth calculation, allowing columns to become negative or
excessively small during drag operations. Add a minimum width constraint by
clamping nextWidth to a reasonable minimum value (such as 20 or 30 pixels)
before assigning it to updatedColumnWidth and applying it to th.style.width.
This prevents column collapse and maintains layout stability during resizing
operations.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 139-196: The LoadServerData method updates serverLoading and
serverLastRequest at the end but does not trigger a final StateHasChanged call
to re-render the parent component. Since this is a callback function, these
state changes may render late or not at all. Wrap the lines that set
serverLoading to false and update serverLastRequest in a finally block, and add
an await InvokeAsync(StateHasChanged) call within that finally block to ensure
the parent component always re-renders after the data loading operation
completes.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cs`:
- Around line 384-386: The Razor snippet in the
BitQuickGridDemo.razor.samples.cs file binds to `virtualSampleNameFilter` in the
`@bind-Value` attribute of the BitSearchBox component, but the corresponding C#
property is defined as `VirtualSampleNameFilter` in PascalCase. Update the
binding to use `VirtualSampleNameFilter` to match the actual property name
defined in the C# code-behind, ensuring the sample compiles correctly when
copied.
- Around line 1090-1093: The BitButton component at lines 1090-1093 that
controls row expansion lacks accessibility attributes. Add a dynamic AriaLabel
or Title attribute to the BitButton element that changes based on the expansion
state. The label should indicate whether clicking the button will expand or
collapse the row, similar to the implementation in the runtime demo. Reference
the expandedRowTemplateCodes collection to conditionally set the label, matching
the same logic used for the IconName attribute selection.
---
Duplicate comments:
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs`:
- Around line 89-92: In the BitDataGridDataProcessor.cs file where the path
variable is constructed using string interpolation with g.Key, replace the
simple string concatenation of g.Key with a typed, culture-invariant identifier
that prevents collisions between distinct keys producing identical text. Instead
of relying on the string representation of g.Key which can be culture-dependent
and cause identical display values to collide, use a robust uniqueness mechanism
such as the key's hash code or another unique type-safe identifier that
preserves the actual key identity across different key instances.
---
Nitpick comments:
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cs`:
- Line 9: The `FormattedValue` property in the `BitDataGridAggregateResult`
class has a default value of `string.Empty` but is not marked as `required`,
creating an inconsistency with the `ColumnId` property which is required. To fix
this, either mark `FormattedValue` as `required` to match the pattern of
`ColumnId`, or change its type to `string?` and set the default value to `null`
to properly represent it as an optional nullable property. Choose the approach
that best represents the semantic intent of this property in your data model.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cs`:
- Line 25: The BitDataGridCellEventArgs class has inconsistent use of the
required modifier. The Value property at line 25 and Mouse property at line 28
are not marked as required, while Item and Column properties are. Since the
construction code in BitDataGrid.razor.cs always explicitly sets all four
properties when creating new instances, either add the required modifier to the
Value and Mouse properties to match Item and Column for consistency and
compile-time safety, or add documentation comments explaining why these two
properties are intentionally optional despite always being set during
construction.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e5869d38-2410-48a4-ad7d-364183e27bec
📒 Files selected for processing (86)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (6)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (1)
src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs (1)
324-346:⚠️ Potential issue | 🟠 Major | ⚡ Quick winEnsure CTS cleanup also runs for the virtualized branch.
thisLoadCtscleanup is currently only guaranteed in the non-virtualizedfinally. IfRefreshDataAsync()throws in the virtualized path,_pendingDataLoadCancellationTokenSourcecan stay non-null and undisposed.Suggested minimal restructuring
private async Task RefreshDataCoreAsync() { var previousCts = _pendingDataLoadCancellationTokenSource; if (previousCts is not null) { previousCts.Cancel(); previousCts.Dispose(); } var thisLoadCts = _pendingDataLoadCancellationTokenSource = new CancellationTokenSource(); - - if (_virtualizeComponent is not null) - { - await _virtualizeComponent.RefreshDataAsync(); - if (ReferenceEquals(_pendingDataLoadCancellationTokenSource, thisLoadCts)) - { - thisLoadCts.Dispose(); - _pendingDataLoadCancellationTokenSource = null; - } - } - else + try { - _lastRefreshedPaginationStateHash = Pagination?.GetHashCode(); - var startIndex = Pagination is null ? 0 : (Pagination.CurrentPageIndex * Pagination.ItemsPerPage); - var request = new BitQuickGridItemsProviderRequest<TGridItem>( - startIndex, Pagination?.ItemsPerPage, _sortByColumn, _sortByAscending, thisLoadCts.Token); - try + if (_virtualizeComponent is not null) { - var result = await ResolveItemsRequestAsync(request); - if (!thisLoadCts.IsCancellationRequested) - { - _currentNonVirtualizedViewItems = result.Items; - _ariaBodyRowCount = _currentNonVirtualizedViewItems.Count; - await (Pagination?.SetTotalItemCountAsync(result.TotalItemCount) ?? Task.CompletedTask); - } + await _virtualizeComponent.RefreshDataAsync(); } - catch (OperationCanceledException) + else { - // This load was superseded by a newer request; swallow the cancellation and fall through - // to the cleanup below so the load-state remains consistent. + _lastRefreshedPaginationStateHash = Pagination?.GetHashCode(); + var startIndex = Pagination is null ? 0 : (Pagination.CurrentPageIndex * Pagination.ItemsPerPage); + var request = new BitQuickGridItemsProviderRequest<TGridItem>( + startIndex, Pagination?.ItemsPerPage, _sortByColumn, _sortByAscending, thisLoadCts.Token); + var result = await ResolveItemsRequestAsync(request); + if (!thisLoadCts.IsCancellationRequested) + { + _currentNonVirtualizedViewItems = result.Items; + _ariaBodyRowCount = _currentNonVirtualizedViewItems.Count; + await (Pagination?.SetTotalItemCountAsync(result.TotalItemCount) ?? Task.CompletedTask); + } } - finally - { - if (ReferenceEquals(_pendingDataLoadCancellationTokenSource, thisLoadCts)) - { - thisLoadCts.Dispose(); - _pendingDataLoadCancellationTokenSource = null; - } - } + } + catch (OperationCanceledException) when (thisLoadCts.IsCancellationRequested) + { + // Superseded by a newer request. + } + finally + { + if (ReferenceEquals(_pendingDataLoadCancellationTokenSource, thisLoadCts)) + { + _pendingDataLoadCancellationTokenSource = null; + } + thisLoadCts.Dispose(); } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs` around lines 324 - 346, The RefreshDataCoreAsync method's virtualized branch does not guarantee cleanup of thisLoadCts if an exception is thrown during the RefreshDataAsync() call on the _virtualizeComponent. The cleanup logic that disposes thisLoadCts and clears _pendingDataLoadCancellationTokenSource (the ReferenceEquals check) should be wrapped in a try-finally block around the virtualized code path to ensure it always executes even when RefreshDataAsync() throws, preventing resource leaks and keeping _pendingDataLoadCancellationTokenSource properly managed.
🧹 Nitpick comments (7)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs (1)
323-364: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winReset
loadinginfinallyand honor cancellation in the server-read sample.This sample can leave
loading = trueif an exception/cancellation happens before Line 362. SinceBitDataGridReadRequestexposesCancellationToken, it should be used in the simulated async work as well.Suggested snippet adjustment
private async Task<BitDataGridReadResult<Product>> LoadData(BitDataGridReadRequest request) { - loading = true; - await Task.Delay(250); // simulate a backend round-trip - - IEnumerable<Product> query = all; - - // filtering - foreach (var f in request.Filters) - { - var term = f.Value?.ToString() ?? ""; - query = f.ColumnId switch - { - nameof(Product.Name) => query.Where(p => p.Name.Contains(term, StringComparison.OrdinalIgnoreCase)), - nameof(Product.Price) => query.Where(p => p.Price.ToString().Contains(term)), - nameof(Product.Id) => query.Where(p => p.Id.ToString().Contains(term)), - _ => query - }; - } - - // sorting - var sort = request.Sorts.FirstOrDefault(); - if (sort is not null) - { - Func<Product, object> key = sort.ColumnId switch - { - nameof(Product.Name) => p => p.Name, - nameof(Product.Price) => p => p.Price, - _ => p => p.Id - }; - query = sort.Direction == BitDataGridSortDirection.Descending - ? query.OrderByDescending(key) - : query.OrderBy(key); - } - - // paging - var filtered = query.ToList(); - var items = filtered.Skip(request.Skip).Take(request.Take ?? filtered.Count).ToList(); - - loading = false; - return new BitDataGridReadResult<Product>(items, filtered.Count); + loading = true; + try + { + await Task.Delay(250, request.CancellationToken); // simulate a backend round-trip + + IEnumerable<Product> query = all; + + // filtering + foreach (var f in request.Filters) + { + var term = f.Value?.ToString() ?? ""; + query = f.ColumnId switch + { + nameof(Product.Name) => query.Where(p => p.Name.Contains(term, StringComparison.OrdinalIgnoreCase)), + nameof(Product.Price) => query.Where(p => p.Price.ToString().Contains(term)), + nameof(Product.Id) => query.Where(p => p.Id.ToString().Contains(term)), + _ => query + }; + } + + // sorting + var sort = request.Sorts.FirstOrDefault(); + if (sort is not null) + { + Func<Product, object> key = sort.ColumnId switch + { + nameof(Product.Name) => p => p.Name, + nameof(Product.Price) => p => p.Price, + _ => p => p.Id + }; + query = sort.Direction == BitDataGridSortDirection.Descending + ? query.OrderByDescending(key) + : query.OrderBy(key); + } + + // paging + var filtered = query.ToList(); + var items = filtered.Skip(request.Skip).Take(request.Take ?? filtered.Count).ToList(); + return new BitDataGridReadResult<Product>(items, filtered.Count); + } + finally + { + loading = false; + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs` around lines 323 - 364, The LoadData method sets loading to true but only resets it to false at the end of the method, leaving it stuck at true if an exception occurs. Additionally, the simulated async work via Task.Delay does not honor the CancellationToken from the BitDataGridReadRequest. Wrap the method body in a try-finally block and move the loading = false assignment to the finally block to ensure it always executes regardless of exceptions. Also, pass request.CancellationToken to the Task.Delay call to respect cancellation requests.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor (2)
403-403: 🧹 Nitpick | 🔵 Trivial | 💤 Low value
int.Parsecould throw on malformed select value.While the
<select>only contains valid integer options, usingint.Parsewithout validation is fragile. Considerint.TryParsefor defensive coding.♻️ Defensive parsing
-<select class="bit-dtg-page-size" `@onchange`="e => SetPageSizeAsync(int.Parse((string)e.Value!))"> +<select class="bit-dtg-page-size" `@onchange`="e => { if (int.TryParse((string?)e.Value, out var size)) _ = SetPageSizeAsync(size); }">🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` at line 403, The select element's `@onchange` handler in the page size dropdown uses int.Parse without error handling, which can throw exceptions if the value is malformed. Replace int.Parse((string)e.Value!) with int.TryParse to safely attempt the conversion and gracefully handle parsing failures. Check the result of TryParse before calling SetPageSizeAsync, and only proceed if the conversion succeeds.
27-31: 🧹 Nitpick | 🔵 Trivial | ⚖️ Poor tradeoffCSV data URI export may fail for large datasets.
The CSV export uses a
data:text/csvURI which has browser-specific length limits (typically 2MB in modern browsers, but varies). For grids with thousands of rows, this approach may silently truncate or fail.Consider adding a fallback using Blob URLs or JS interop for larger exports if this becomes an issue.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 27 - 31, The CSV export functionality in the BitDataGrid component uses a data:text/csv URI approach which has browser limitations (typically 2MB) and may silently fail for large datasets. Modify the CSV export section to check the size of the CSV data generated by the ToCsv() method, and if it exceeds a reasonable threshold (around 1-2MB), implement a fallback approach using Blob URLs or JavaScript interop to trigger the download instead of using the data URI. This ensures large exports work reliably while maintaining backward compatibility for smaller datasets that work fine with the current data URI approach.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs (3)
226-226: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
VisibleColumnsallocates a new list on every access.The property
VisibleColumnscalls.ToList()on every access, creating a new allocation each time. It's accessed frequently (header rendering, cell navigation, spanning, footer, etc.), causing unnecessary GC pressure.♻️ Consider caching the visible columns list
+ private IReadOnlyList<BitDataGridColumn<TItem>>? _visibleColumnsCache; + private int _visibleColumnsVersion; + - internal IReadOnlyList<BitDataGridColumn<TItem>> VisibleColumns => _columns.Where(c => c.Visible).ToList(); + internal IReadOnlyList<BitDataGridColumn<TItem>> VisibleColumns + { + get + { + // Invalidate cache when columns change + if (_visibleColumnsCache is null || _visibleColumnsVersion != _columns.Count) + { + _visibleColumnsCache = _columns.Where(c => c.Visible).ToList(); + _visibleColumnsVersion = _columns.Count; + } + return _visibleColumnsCache; + } + }Also invalidate the cache in
AddColumn,RemoveColumn, andSetColumnVisibilityAsync.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs` at line 226, The VisibleColumns property creates a new list allocation on every access via .ToList(), causing unnecessary garbage collection. Cache the filtered list result in a private field (e.g., _visibleColumnsCache) and update the VisibleColumns property to return the cached value. Invalidate the cache by resetting it to null in the AddColumn, RemoveColumn, and SetColumnVisibilityAsync methods so the list is only recalculated when columns are actually modified, not on every property access.
734-735: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueMultiple enumerations over
_pageItemsfor selection state.
AllPageSelectedandSomePageSelectedboth call_pageItems.Where(CanSelectRow)multiple times, causing repeated enumeration. Consider caching the selectable items.♻️ Suggested optimization
- internal bool AllPageSelected => _pageItems.Where(CanSelectRow).Any() && _pageItems.Where(CanSelectRow).All(_selected.Contains); - internal bool SomePageSelected => _pageItems.Where(CanSelectRow).Any(_selected.Contains) && !AllPageSelected; + internal bool AllPageSelected + { + get + { + var selectable = _pageItems.Where(CanSelectRow).ToList(); + return selectable.Count > 0 && selectable.All(_selected.Contains); + } + } + + internal bool SomePageSelected + { + get + { + var selectable = _pageItems.Where(CanSelectRow).ToList(); + return selectable.Any(_selected.Contains) && !selectable.All(_selected.Contains); + } + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs` around lines 734 - 735, The AllPageSelected and SomePageSelected properties both enumerate _pageItems.Where(CanSelectRow) multiple times within their respective expressions, causing inefficient repeated filtering. Refactor both properties by caching the filtered enumerable result (the result of _pageItems.Where(CanSelectRow)) into a local variable first, then use that cached variable in the subsequent checks with Any, All, and Contains operations to avoid multiple enumerations.
1068-1072: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winUnnecessary list allocation in
ResolveColSpan.
cols.ToList().IndexOf(column)creates a temporary list just to find the index. Use a loop or LINQ instead.♻️ Suggested fix
internal int ResolveColSpan(BitDataGridColumn<TItem> column, TItem item) { if (column.ColSpan is null) return 1; var span = column.ColSpan(item) ?? 1; if (span < 1) span = 1; var cols = VisibleColumns; - var idx = cols.ToList().IndexOf(column); + var idx = -1; + for (int i = 0; i < cols.Count; i++) + { + if (cols[i] == column) { idx = i; break; } + } if (idx < 0) return 1; return Math.Min(span, cols.Count - idx); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs` around lines 1068 - 1072, The ResolveColSpan method is creating an unnecessary temporary list by calling cols.ToList() solely to use the IndexOf method for finding the column's position. Replace this inefficient approach by either using LINQ enumeration-based indexing without materialization, or iterating through the cols collection with a counter to find the index position directly, avoiding the allocation of the temporary list.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor (1)
24-31: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueSelect element has redundant value binding.
The
<select>element has bothvalue="@(GetString())"and each<option>hasselected="@(name == GetString())". The Blazorvaluebinding on<select>should suffice; the explicitselectedattribute is redundant and can cause inconsistent behavior in some browsers.♻️ Suggested simplification
- <select class="bit-dtg-editor" value="@(GetString())" `@onchange`="e => Set(e.Value)"> + <select class="bit-dtg-editor" `@bind`="`@_enumValue`" `@bind`:event="onchange" `@bind`:after="() => Set(_enumValue)"> `@foreach` (var name in Enum.GetNames(Column.Accessor!.UnderlyingType)) { - <option value="`@name`" selected="@(name == GetString())">`@name`</option> + <option value="`@name`">`@name`</option> } </select>Or simply remove the
selectedattribute sincevalueon<select>handles selection:- <option value="`@name`" selected="@(name == GetString())">`@name`</option> + <option value="`@name`">`@name`</option>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor` around lines 24 - 31, The Enum case in the BitDataGridCellEditor.razor component has redundant selection binding on the select element. Remove the explicit selected="@(name == GetString())" attribute from each option element within the foreach loop, as the value binding on the parent select element with value="@(GetString())" already handles selecting the correct option in Blazor. Keep only the value binding on the select element for proper Blazor two-way binding behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 11-18: The invokeMethodAsync call in the check function lacks
error handling for promise rejections that may occur if the Blazor circuit
disconnects between the disposed flag check and the async method invocation. Add
a .catch() handler to the
dotNetRef.invokeMethodAsync('OnInfiniteScrollNearEndAsync') call to gracefully
handle potential promise rejections and prevent unhandled rejection errors in
the console during circuit disconnects or navigation.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs`:
- Around line 201-219: The filter evaluation in the method has incorrect null
comparison semantics. The early return on line 201-202 when filter.Value is null
causes all rows to match, which is incorrect for Equals and NotEquals operators.
Additionally, when the row value itself is null, null values are passed to the
comparer which can cause incorrect matches for LessThan and LessThanOrEqual
operators. Remove the early return for null filter values, and instead add
proper null handling logic that checks if the row value is null separately
before calling BitDataGridValueComparer.Instance.Compare(). When the row value
is null, return false for comparison operators (GreaterThan, GreaterThanOrEqual,
LessThan, LessThanOrEqual) and handle Equals/NotEquals based on whether the
filter value is also null.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs`:
- Around line 89-90: The Split call in BitDataGridPropertyAccessor.cs uses
StringSplitOptions.RemoveEmptyEntries which silently normalizes malformed paths
like "." and "Address..City" instead of rejecting them. Remove the
RemoveEmptyEntries option from the Split call and add validation logic to check
if any segments are empty or whitespace, then throw an appropriate exception
(such as ArgumentException) if found, ensuring that only valid property paths
are processed and preventing silent misbinding in sort/filter/edit operations.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 411-414: The ProvideVirtualizedItems method calls
ResolveItemsRequestAsync which can throw OperationCanceledException when the
virtualized request is superseded by a newer request after debounce. Wrap the
ResolveItemsRequestAsync call in a try-catch block to explicitly catch and
handle OperationCanceledException so it does not propagate out of the
ProvideVirtualizedItems method. Handle the exception appropriately by returning
an empty or default result set that the virtualization system expects.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 215-231: The LoadMore method currently applies only the first sort
descriptor from request.Sorts by using FirstOrDefault(), which causes
multi-column sorts to be ignored. Replace the single sort application logic with
a loop that iterates through all items in request.Sorts (if any exist) and
applies each sort descriptor sequentially to the query. Reuse the key selector
switch statement that maps sort.ColumnId to the Product properties for each sort
descriptor, applying OrderByDescending or OrderBy based on each sort's Direction
property to maintain proper multi-sort ordering.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 324-346: The RefreshDataCoreAsync method's virtualized branch does
not guarantee cleanup of thisLoadCts if an exception is thrown during the
RefreshDataAsync() call on the _virtualizeComponent. The cleanup logic that
disposes thisLoadCts and clears _pendingDataLoadCancellationTokenSource (the
ReferenceEquals check) should be wrapped in a try-finally block around the
virtualized code path to ensure it always executes even when RefreshDataAsync()
throws, preventing resource leaks and keeping
_pendingDataLoadCancellationTokenSource properly managed.
---
Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`:
- Line 403: The select element's `@onchange` handler in the page size dropdown
uses int.Parse without error handling, which can throw exceptions if the value
is malformed. Replace int.Parse((string)e.Value!) with int.TryParse to safely
attempt the conversion and gracefully handle parsing failures. Check the result
of TryParse before calling SetPageSizeAsync, and only proceed if the conversion
succeeds.
- Around line 27-31: The CSV export functionality in the BitDataGrid component
uses a data:text/csv URI approach which has browser limitations (typically 2MB)
and may silently fail for large datasets. Modify the CSV export section to check
the size of the CSV data generated by the ToCsv() method, and if it exceeds a
reasonable threshold (around 1-2MB), implement a fallback approach using Blob
URLs or JavaScript interop to trigger the download instead of using the data
URI. This ensures large exports work reliably while maintaining backward
compatibility for smaller datasets that work fine with the current data URI
approach.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Line 226: The VisibleColumns property creates a new list allocation on every
access via .ToList(), causing unnecessary garbage collection. Cache the filtered
list result in a private field (e.g., _visibleColumnsCache) and update the
VisibleColumns property to return the cached value. Invalidate the cache by
resetting it to null in the AddColumn, RemoveColumn, and
SetColumnVisibilityAsync methods so the list is only recalculated when columns
are actually modified, not on every property access.
- Around line 734-735: The AllPageSelected and SomePageSelected properties both
enumerate _pageItems.Where(CanSelectRow) multiple times within their respective
expressions, causing inefficient repeated filtering. Refactor both properties by
caching the filtered enumerable result (the result of
_pageItems.Where(CanSelectRow)) into a local variable first, then use that
cached variable in the subsequent checks with Any, All, and Contains operations
to avoid multiple enumerations.
- Around line 1068-1072: The ResolveColSpan method is creating an unnecessary
temporary list by calling cols.ToList() solely to use the IndexOf method for
finding the column's position. Replace this inefficient approach by either using
LINQ enumeration-based indexing without materialization, or iterating through
the cols collection with a counter to find the index position directly, avoiding
the allocation of the temporary list.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor`:
- Around line 24-31: The Enum case in the BitDataGridCellEditor.razor component
has redundant selection binding on the select element. Remove the explicit
selected="@(name == GetString())" attribute from each option element within the
foreach loop, as the value binding on the parent select element with
value="@(GetString())" already handles selecting the correct option in Blazor.
Keep only the value binding on the select element for proper Blazor two-way
binding behavior.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs`:
- Around line 323-364: The LoadData method sets loading to true but only resets
it to false at the end of the method, leaving it stuck at true if an exception
occurs. Additionally, the simulated async work via Task.Delay does not honor the
CancellationToken from the BitDataGridReadRequest. Wrap the method body in a
try-finally block and move the loading = false assignment to the finally block
to ensure it always executes regardless of exceptions. Also, pass
request.CancellationToken to the Task.Delay call to respect cancellation
requests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 181acf5c-8519-490b-bb7d-03de1ca65181
📒 Files selected for processing (86)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (6)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 10
🧹 Nitpick comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cs (1)
13-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting common generation logic to reduce duplication.
The
GenerateandGeneratePersianmethods duplicate the entire Product generation algorithm. Only the string arrays differ (adjectives, nouns, suppliers). Extracting the common logic into a shared helper would improve maintainability and ensure consistency when updating the generation algorithm.♻️ Refactoring approach
Extract a private helper that accepts the string arrays as parameters:
+ private static List<Product> GenerateCore( + int count, + int seed, + string[] adjectives, + string[] nouns, + string[] suppliers) + { + var rng = new Random(seed); + var categories = Enum.GetValues<Category>(); + var list = new List<Product>(count); + var referenceDate = new DateTime(2024, 1, 1); + for (int i = 1; i <= count; i++) + { + list.Add(new Product + { + Id = i, + Name = $"{adjectives[rng.Next(adjectives.Length)]} {nouns[rng.Next(nouns.Length)]} {rng.Next(100, 999)}", + Category = categories[rng.Next(categories.Length)], + Price = Math.Round((decimal)(rng.NextDouble() * 990 + 5), 2), + Stock = rng.Next(0, 500), + Rating = Math.Round(rng.NextDouble() * 4 + 1, 1), + Discontinued = rng.Next(0, 5) == 0, + ReleaseDate = referenceDate.AddDays(-rng.Next(0, 2000)), + Supplier = suppliers[rng.Next(suppliers.Length)] + }); + } + return list; + } + public static List<Product> Generate(int count, int seed = 42) - { - var rng = new Random(seed); - var categories = Enum.GetValues<Category>(); - var list = new List<Product>(count); - var referenceDate = new DateTime(2024, 1, 1); - for (int i = 1; i <= count; i++) - { - list.Add(new Product - { - Id = i, - Name = $"{Adjectives[rng.Next(Adjectives.Length)]} {Nouns[rng.Next(Nouns.Length)]} {rng.Next(100, 999)}", - Category = categories[rng.Next(categories.Length)], - Price = Math.Round((decimal)(rng.NextDouble() * 990 + 5), 2), - Stock = rng.Next(0, 500), - Rating = Math.Round(rng.NextDouble() * 4 + 1, 1), - Discontinued = rng.Next(0, 5) == 0, - ReleaseDate = referenceDate.AddDays(-rng.Next(0, 2000)), - Supplier = Suppliers[rng.Next(Suppliers.Length)] - }); - } - return list; - } + => GenerateCore(count, seed, Adjectives, Nouns, Suppliers); public static List<Product> GeneratePersian(int count, int seed = 42) - { - var rng = new Random(seed); - var categories = Enum.GetValues<Category>(); - var list = new List<Product>(count); - var referenceDate = new DateTime(2024, 1, 1); - for (int i = 1; i <= count; i++) - { - list.Add(new Product - { - Id = i, - Name = $"{PersianAdjectives[rng.Next(PersianAdjectives.Length)]} {PersianNouns[rng.Next(PersianNouns.Length)]} {rng.Next(100, 999)}", - Category = categories[rng.Next(categories.Length)], - Price = Math.Round((decimal)(rng.NextDouble() * 990 + 5), 2), - Stock = rng.Next(0, 500), - Rating = Math.Round(rng.NextDouble() * 4 + 1, 1), - Discontinued = rng.Next(0, 5) == 0, - ReleaseDate = referenceDate.AddDays(-rng.Next(0, 2000)), - Supplier = PersianSuppliers[rng.Next(PersianSuppliers.Length)] - }); - } - return list; - } + => GenerateCore(count, seed, PersianAdjectives, PersianNouns, PersianSuppliers);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cs` around lines 13 - 68, The Generate and GeneratePersian methods contain duplicate code for the entire Product generation algorithm, differing only in which string arrays they use. Create a private helper method that accepts three string array parameters (for adjectives, nouns, and suppliers) and contains the common generation logic currently duplicated in both methods. Then refactor the Generate method to call this helper with Adjectives, Nouns, and Suppliers arrays, and the GeneratePersian method to call it with PersianAdjectives, PersianNouns, and PersianSuppliers arrays. This will eliminate duplication while maintaining the same external behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Around line 456-498: The LoadNextBatchAsync method awaits the OnLoadMore
callback which receives a cancellation token from ResetLoadCancellation(). If
the provider honors the cancellation token, it will throw an
OperationCanceledException that breaks the component flow. Wrap the await
statement for OnLoadMore in a try-catch block to catch
OperationCanceledException and handle it gracefully by returning early, since
cancellation is expected behavior when requests are superseded by newer loads.
This same fix should also be applied to any other similar load methods mentioned
in the "Also applies to" section that use ResetLoadCancellation() tokens.
- Around line 1199-1212: The Escape static method within the ToCsv() method
currently only handles CSV delimiter escaping but does not prevent formula
injection. When cell values begin with =, +, -, or @, spreadsheet applications
can interpret them as formulas when the CSV file is opened. Modify the Escape
static method to detect if the input value starts with any of these dangerous
characters and prepend a single quote to prevent formula execution, in addition
to the existing CSV delimiter escaping logic.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor`:
- Line 13: The `@onkeydown`="HandleKeyDown" binding at line 13 does not prevent
the default browser keyboard behavior, which can conflict with the grid
navigation logic implemented in the HandleKeyDown method (referenced around line
70). Modify the onkeydown event binding to include preventDefault:true parameter
to suppress native browser key handling and ensure the custom grid navigation
logic executes exclusively without browser defaults interfering with the
cell-navigation behavior.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor`:
- Around line 24-27: The enum editor case in BitDataGridCellEditor.razor does
not validate that Column.Accessor exists and that its UnderlyingType is actually
an enum before attempting to call Enum.GetNames on it. Add a guard condition
before the select element that checks whether Column.Accessor is not null and
whether Column.Accessor.UnderlyingType is a valid enum type using Type.IsEnum.
If the guard condition fails, render a fallback editor instead of the enum
select dropdown to prevent null reference exceptions and invalid type operations
at runtime.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs`:
- Around line 36-40: The ConvertValue method (referenced around lines 68-70) is
silently coercing conversion failures to default values for non-nullable
properties, which causes invalid user input to be silently overwritten with
defaults like 0. Instead of silently returning default(T) on conversion failure,
modify ConvertValue to throw an exception or return a result that indicates
conversion failure, then update the SetValue method to handle this exception or
failure result appropriately by either not setting the value or propagating the
error to the caller so users are aware their invalid input was rejected rather
than silently converted.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 302-306: The call to _js.BitQuickGridCheckColumnOptionsPosition on
line 305 discards the returned ValueTask using the discard pattern instead of
awaiting it. Since the containing method is already async, replace the line that
discards the result with `await
_js.BitQuickGridCheckColumnOptionsPosition(_tableReference);` to properly await
the interop call and ensure positioning errors are not hidden.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor`:
- Around line 156-161: The Math.Round(p.Rating) call on line 160 uses banker's
rounding (midpoint-to-even), which causes inconsistent star rendering when the
rating is exactly at a midpoint value like 4.5. To fix this, replace
Math.Round(p.Rating) with Math.Round(p.Rating, MidpointRounding.AwayFromZero) to
ensure values round away from zero, providing more intuitive and consistent
visual feedback in the star rating display within the span element.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 139-144: The LoadServerData method and other async loader methods
do not honor the CancellationToken provided in BitDataGridReadRequest, allowing
superseded requests to complete and update stale UI state. Pass
request.CancellationToken to the Task.Delay() calls, and check for cancellation
(using ThrowIfCancellationRequested or similar checks) before updating UI state
variables like serverLoading, serverLastRequest, and infiniteLog to prevent
stale data from being written when a newer request supersedes the current one.
Apply this fix to all async loader methods mentioned, including LoadServerData
and any other similar loaders at the specified locations.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs`:
- Around line 346-358: The sort logic in this sample applies only the first sort
descriptor using FirstOrDefault() and ignores all additional sorts. Instead of
handling only a single sort, iterate through all items in request.Sorts and
chain the sort operations using OrderBy/OrderByDescending for the first sort and
ThenBy/ThenByDescending for subsequent sorts based on their respective column
IDs and directions. Apply this same complete sorting logic to both the initial
query sorting section (around the switch statement with Product.Name,
Product.Price cases) and the LoadMore method (lines 382-386) which currently
ignores request.Sorts entirely, ensuring consistent sort semantics are applied
in both code paths.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cs`:
- Around line 629-630: The controller route definitions at lines 629, 736, 810,
and 904 use the attribute Route with pattern "[controller]/[action]" but the
client sample code expects routes prefixed with "api/". Update the Route
attribute in all four controller definitions (ProductsController and other
similar controllers) to include the "api/" prefix in the route pattern, changing
"[controller]/[action]" to "api/[controller]/[action]" to ensure consistency
between the server-side sample and the client-side usage.
---
Nitpick comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cs`:
- Around line 13-68: The Generate and GeneratePersian methods contain duplicate
code for the entire Product generation algorithm, differing only in which string
arrays they use. Create a private helper method that accepts three string array
parameters (for adjectives, nouns, and suppliers) and contains the common
generation logic currently duplicated in both methods. Then refactor the
Generate method to call this helper with Adjectives, Nouns, and Suppliers
arrays, and the GeneratePersian method to call it with PersianAdjectives,
PersianNouns, and PersianSuppliers arrays. This will eliminate duplication while
maintaining the same external behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ca5f25fb-53db-4b03-bab4-dc6a2e8df316
📒 Files selected for processing (86)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (6)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 7
♻️ Duplicate comments (2)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs (1)
141-147: 🩺 Stability & Availability | 🟠 MajorMove the cancellable delay inside
tryso cleanup always remains in scope.At Line 143,
await Task.Delay(250, request.CancellationToken)can throw before thetryblock at Line 146, causing thefinallycleanup (Lines 198–209) to be bypassed and leavingserverLoadingin an inconsistent state.Proposed fix
private async Task<BitDataGridReadResult<Product>> LoadServerData(BitDataGridReadRequest request) { serverLoading = true; await InvokeAsync(StateHasChanged); - await Task.Delay(250, request.CancellationToken); int total = 0; try { + await Task.Delay(250, request.CancellationToken); + IEnumerable<Product> query = serverAll;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs` around lines 141 - 147, The cancellable Task.Delay on line 143 can throw a cancellation exception before entering the try block that starts on line 146, which causes the finally cleanup block to be bypassed and leaves serverLoading in an inconsistent state. Move the await Task.Delay(250, request.CancellationToken) statement inside the try block so that the finally cleanup block (lines 198-209) will always execute regardless of whether the delay is cancelled, ensuring serverLoading is properly reset.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs (1)
1226-1235: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winQuote CSV fields containing carriage returns.
Line 1233 quotes
\nbut not\r, so CR-only values can split rows in spreadsheet parsers. Include\rin the quoting condition.Suggested fix
- return v.Contains(',') || v.Contains('"') || v.Contains('\n') + return v.Contains(',') || v.Contains('"') || v.Contains('\n') || v.Contains('\r') ? "\"" + v.Replace("\"", "\"\"") + "\"" : v;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs` around lines 1226 - 1235, The Escape method checks for newline characters (\n) when deciding whether to quote CSV fields, but it does not include carriage return characters (\r) in the quoting condition. Update the return statement in the Escape method to also check for \r using an additional .Contains('\r') condition alongside the existing checks for comma, double quote, and newline, so that fields containing carriage returns are properly quoted to prevent row splitting in spreadsheet parsers.
🧹 Nitpick comments (3)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cs (1)
4-9: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd XML documentation to properties.
All properties lack documentation summaries, reducing IntelliSense discoverability.
📝 Proposed XML documentation additions
public sealed class BitDataGridFilterDescriptor { + /// <summary>Identifier of the column being filtered.</summary> public required string ColumnId { get; init; } + /// <summary>The filter operation to apply (e.g., Contains, Equals, GreaterThan).</summary> public BitDataGridFilterOperator Operator { get; set; } = BitDataGridFilterOperator.Contains; + /// <summary>The filter value to compare against, or null for operators like IsNull.</summary> public object? Value { get; set; } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cs` around lines 4 - 9, The BitDataGridFilterDescriptor class properties (ColumnId, Operator, and Value) lack XML documentation comments, which prevents IntelliSense from displaying helpful information for developers using these properties. Add XML documentation summary comments above each property using the standard /// <summary> syntax to describe what each property represents and its purpose in the filter descriptor context.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cs (1)
4-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd XML documentation to properties for IntelliSense clarity.
All properties lack individual doc summaries. Even simple DTOs benefit from documentation that appears in IDE tooltips and API docs.
📝 Proposed XML documentation additions
public sealed class BitDataGridAggregateResult { + /// <summary>Identifier of the column this aggregate result applies to.</summary> public required string ColumnId { get; init; } + /// <summary>The type of aggregate function applied (sum, average, count, etc.).</summary> public BitDataGridAggregateType Type { get; init; } + /// <summary>The raw computed aggregate value, or null if computation produced no result.</summary> public object? Value { get; init; } + /// <summary>The formatted string representation of the aggregate value for display.</summary> public required string FormattedValue { get; init; } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cs` around lines 4 - 10, The BitDataGridAggregateResult class and its properties are missing XML documentation comments that would provide IntelliSense clarity in IDEs and API documentation. Add XML documentation comments above each property (ColumnId, Type, Value, and FormattedValue) in the BitDataGridAggregateResult class using the summary tags to describe what each property represents, its purpose, and any relevant details about its usage or constraints.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cs (1)
10-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd XML documentation to undocumented properties for better IntelliSense discoverability.
Properties
ColumnId,KeyText,Aggregates, and the computed propertyHasSubGroupslack XML documentation summaries, which reduces discoverability in IntelliSense and impacts documentation generation. Lines 14 and 30 demonstrate the pattern already in use.📝 Proposed XML documentation additions
public sealed class BitDataGridGroup<TItem> { + /// <summary>Identifier of the column used for grouping.</summary> public required string ColumnId { get; init; } + /// <summary>The grouping key value for this group.</summary> public required object? Key { get; init; } + /// <summary>Human-readable text representation of the grouping key.</summary> public string KeyText { get; init; } = string.Empty; /// <summary>Zero-based nesting depth (0 = top level).</summary> public int Level { get; init; } /// <summary>Stable, unique path identifying this group across the whole tree (used for collapse state).</summary> public required string Path { get; init; } /// <summary>All rows that fall under this group (across nested subgroups).</summary> public List<TItem> Items { get; init; } = new(); /// <summary>Child groups when this group is further grouped; empty for leaf groups.</summary> public List<BitDataGridGroup<TItem>> SubGroups { get; init; } = new(); + /// <summary>Computed aggregates (e.g., sum, average) for columns in this group.</summary> public List<BitDataGridAggregateResult> Aggregates { get; init; } = new(); + /// <summary>Indicates whether this group contains child groups (subgroups).</summary> public bool HasSubGroups => SubGroups.Count > 0;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cs` around lines 10 - 26, The properties ColumnId, KeyText, and Aggregates in the BitDataGridGroup class are missing XML documentation summaries, which reduces IntelliSense discoverability. Add XML documentation comments above each of these properties following the same pattern already used for Level, Path, Items, and SubGroups properties. Each summary should provide a brief description of what the property represents in the context of data grid grouping.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`:
- Around line 124-141: The span element with the "bit-dtg-htext" class that
handles OnHeaderClick is not keyboard accessible because it lacks keyboard event
handling. Add a keyboard event handler (such as `@onkeydown`) to this span element
that triggers the sort action when Enter or Space keys are pressed. Create a new
event handler method (such as OnHeaderKeyDown) that checks if the pressed key is
Enter or Space and calls the appropriate sorting method to enable keyboard users
to activate column sorting.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Around line 488-493: The catch block for OperationCanceledException is too
broad and swallows all operation cancellations, including unrelated ones or
provider-side timeouts. Instead of catching all OperationCanceledException
instances, you need to filter the catch block to only handle cancellations from
the grid's own request token. Add a condition inside the catch block or use a
filtered catch pattern to check if the cancellation exception's
CancellationToken property matches the expected grid request token (identify the
token field used for this load operation). If the cancellation is not from the
grid's own token, rethrow the exception so legitimate errors surface. Apply this
same filtering pattern to both occurrences mentioned (lines 488-493 and
583-588).
- Around line 433-448: In the ResetInfiniteAsync method, bump the load version
before awaiting the scrollToTop call to prevent race conditions where older
batches complete during the await and append stale rows to the freshly reset
list. The load version should be incremented immediately after clearing
_infiniteItems and before the try block that awaits
_infiniteHandle.InvokeVoidAsync("scrollToTop"), so that when
ResetLoadCancellation is called later in LoadNextBatchAsync, the version check
will correctly reject any stale batches that completed during the await window.
- Around line 280-289: The inputsChanged check in the BitDataGrid parameter
update logic only compares the Items reference using ReferenceEquals, which
fails to detect when a parent mutates the same collection instance in place
(adding/removing items without changing the reference). This leaves the cached
_view data stale in client-mode scenarios. Modify the inputsChanged condition to
include an additional check that forces a refresh in client-mode data scenarios
even when the Items reference remains the same, while keeping the existing
reference guard for server and infinite scroll modes. This ensures that
RefreshAsync is called when the actual collection contents may have changed.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cs`:
- Around line 1-9: Add XML documentation summaries for the three properties in
the BitDataGridFilterDescriptor class. For the ColumnId property, document that
it represents the identifier of the column being filtered and note that it is
immutable (required init property). For the Operator property, document its
purpose as specifying the filter operation and mention that it defaults to
BitDataGridFilterOperator.Contains. For the Value property, document that it
represents the filter value and note that it is nullable, explaining that its
meaning depends on the selected operator (e.g., not used for IsEmpty or
IsNotEmpty operators).
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs`:
- Around line 388-391: The LoadMore method's Task.Delay call does not respect
the cancellation token provided in the BitDataGridReadRequest parameter. Update
the await Task.Delay(350) statement to pass request.CancellationToken as the
second parameter to Task.Delay so that the sample code correctly honors
cancellation requests, matching the actual implementation behavior.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor`:
- Line 4: The `@using` directive on line 4 of BitQuickGridDemo.razor imports from
Demo.Shared.Dtos.QuickGridDemo, but this namespace does not exist. The actual
namespace is Bit.BlazorUI.Demo.Shared.Dtos.QuickGridDemo as used in the
code-behind file BitQuickGridDemo.razor.cs. Update the `@using` statement to use
the full namespace Bit.BlazorUI.Demo.Shared.Dtos.QuickGridDemo instead of the
abbreviated Demo.Shared.Dtos.QuickGridDemo to match the correct fully-qualified
namespace and allow the code to compile.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cs`:
- Around line 1226-1235: The Escape method checks for newline characters (\n)
when deciding whether to quote CSV fields, but it does not include carriage
return characters (\r) in the quoting condition. Update the return statement in
the Escape method to also check for \r using an additional .Contains('\r')
condition alongside the existing checks for comma, double quote, and newline, so
that fields containing carriage returns are properly quoted to prevent row
splitting in spreadsheet parsers.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 141-147: The cancellable Task.Delay on line 143 can throw a
cancellation exception before entering the try block that starts on line 146,
which causes the finally cleanup block to be bypassed and leaves serverLoading
in an inconsistent state. Move the await Task.Delay(250,
request.CancellationToken) statement inside the try block so that the finally
cleanup block (lines 198-209) will always execute regardless of whether the
delay is cancelled, ensuring serverLoading is properly reset.
---
Nitpick comments:
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cs`:
- Around line 10-26: The properties ColumnId, KeyText, and Aggregates in the
BitDataGridGroup class are missing XML documentation summaries, which reduces
IntelliSense discoverability. Add XML documentation comments above each of these
properties following the same pattern already used for Level, Path, Items, and
SubGroups properties. Each summary should provide a brief description of what
the property represents in the context of data grid grouping.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cs`:
- Around line 4-10: The BitDataGridAggregateResult class and its properties are
missing XML documentation comments that would provide IntelliSense clarity in
IDEs and API documentation. Add XML documentation comments above each property
(ColumnId, Type, Value, and FormattedValue) in the BitDataGridAggregateResult
class using the summary tags to describe what each property represents, its
purpose, and any relevant details about its usage or constraints.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cs`:
- Around line 4-9: The BitDataGridFilterDescriptor class properties (ColumnId,
Operator, and Value) lack XML documentation comments, which prevents
IntelliSense from displaying helpful information for developers using these
properties. Add XML documentation summary comments above each property using the
standard /// <summary> syntax to describe what each property represents and its
purpose in the filter descriptor context.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 5c2fdcdd-b19e-430a-8c6b-b05b04b60e5f
📒 Files selected for processing (86)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (6)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (4)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs (1)
21-35: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftFallback still collapses arbitrary same-type objects into one logical value.
When two values share a type but do not implement
IComparable, Lines 30-35 reduce them to type name +ToString(), and Lines 57-63 hash that same string. For any model that keeps the defaultobject.ToString(), every instance of that type sorts/groups as equal, so unrelated rows can collapse into one bucket. Use a different fallback for unsupported object values (for example, reject them for grouping/sorting, or only useToString()when the type overrides it meaningfully).Also applies to: 48-63
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs` around lines 21 - 35, The fallback in BitDataGridValueComparer is collapsing non-IComparable same-type objects into one value by using type name plus ToString() in the comparison and hash paths, so unrelated rows can be treated as equal. Update the comparer logic in BitDataGridValueComparer to avoid relying on default object.ToString() for unsupported types: either reject/skip grouping and sorting for such values or only apply the fallback when the type provides a meaningful ToString() override, and make the hash implementation match the same rule.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor (1)
7-13: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftGrid-owned keys still run alongside native browser behavior.
Line 13 only subscribes to
keydown, so the keys handled in Lines 57-65 and Line 70 cannot callpreventDefault().Enter/Escapecan still trigger native submit/newline behavior while editing, and navigation keys can still scroll the page while the grid moves focus. This needs key-aware suppression again (likely in the TS layer, not a blanket Razor modifier), otherwise keyboard navigation/edit commit stays unreliable.Also applies to: 49-70
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor` around lines 7 - 13, The grid cell key handling in BitDataGridCell.razor currently only wires HandleKeyDown, so the logic in HandleKeyDown and the related key paths cannot suppress native browser actions. Restore key-aware preventDefault behavior for the grid-owned keys handled in the cell, likely by moving suppression into the TS layer used by the cell instead of relying on the Razor event binding alone, and ensure Enter, Escape, and navigation keys do not also trigger browser submit, newline, or scrolling behavior.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor (2)
476-490: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winClear typed filters instead of installing
Equals null.Blank/invalid typed inputs still flow into
SetFilterAsync(... Equals, null). Since the processor evaluatesEquals/nullas a real null comparison, clearing number/date/boolean/enum filters can hide all non-null rows; use the clear/Unspecifiedpath consistently.Minimal direction
- if (string.IsNullOrWhiteSpace(raw)) - return SetFilterAsync(column, BitDataGridFilterOperator.Equals, null); + if (string.IsNullOrWhiteSpace(raw)) + return SetFilterAsync(column, BitDataGridFilterOperator.Unspecified, null);Apply the same clear behavior to parse-failure branches.
Also applies to: 503-505, 525-541
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 476 - 490, The typed filter parsing in BitDataGrid.razor is using SetFilterAsync(... Equals, null) for blank or parse-failure inputs, which leaves a real null comparison in place instead of clearing the filter. Update the typed branches in the filter handling logic around the number/date/boolean/enum parsing paths to use the clear/Unspecified behavior consistently, including the catch and invalid-input paths, so the filter is removed rather than set to Equals null.
374-420: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winUse valid Razor render-fragment syntax here.
RenderGroupList,RenderGroup, andRenderFilterEditorstill use__builder =>with inline markup. This was already flagged; rewrite these as Razor templates (=> @<...>) or explicitRenderTreeBuildercode so the component compiles reliably.#!/bin/bash # Verify no inline-markup render fragments still use the unsupported __builder pattern. rg -n "=> __builder =>" src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 374 - 420, The render fragments in BitDataGrid are still using the unsupported inline-markup `__builder =>` pattern, which breaks Razor compilation. Update `RenderGroupList`, `RenderGroup`, and `RenderFilterEditor` to use valid Razor fragment syntax (`=> @<...>`) or convert them fully to explicit `RenderTreeBuilder` implementation. Keep the existing behavior for grouped rows, subgroup recursion, and filter rendering, but ensure the fragment declarations are compiler-safe and consistent with the rest of the component.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 126-128: The keyboard capture in BitDataGrid’s edit-row handler is
too broad and suppresses Enter/Escape for nested interactive controls. Update
the logic around the existing e.key check so it still prevents grid-level
behavior for the row, but skips elements like buttons, selects, textareas,
contenteditable nodes, and other controls that should handle their own keyboard
events. Use the current target.closest('.bit-dtg-row') and bit-dtg-editing check
in BitDataGrid.ts to locate the handler and add a guard before calling
preventDefault.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cs`:
- Around line 154-159: Skip unregistering columns that were never accepted by
the grid: in BitDataGridColumn, use the existing _registeredId state to guard
Dispose() so it only calls Grid.RemoveColumn(this) after a successful AddColumn
registration, and otherwise leaves duplicate-id columns alone. Keep the
registration flow in the column lifecycle methods (AddColumn,
SnapshotSemanticParameters, Dispose) consistent so a rejected duplicate cannot
remove the real column that owns the id.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 134-143: Update OnSave and OnDelete in BitDataGridDemo so edited
rows are matched by Product.Id instead of object reference. Replace the
List<Product>.Contains/Remove usage on editProducts with logic that looks up an
existing item by Id, updates or removes that item, and only inserts when no
matching Id exists. Use the Product, OnSave, OnDelete, and editProducts symbols
to locate the handlers.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`:
- Around line 476-490: The typed filter parsing in BitDataGrid.razor is using
SetFilterAsync(... Equals, null) for blank or parse-failure inputs, which leaves
a real null comparison in place instead of clearing the filter. Update the typed
branches in the filter handling logic around the number/date/boolean/enum
parsing paths to use the clear/Unspecified behavior consistently, including the
catch and invalid-input paths, so the filter is removed rather than set to
Equals null.
- Around line 374-420: The render fragments in BitDataGrid are still using the
unsupported inline-markup `__builder =>` pattern, which breaks Razor
compilation. Update `RenderGroupList`, `RenderGroup`, and `RenderFilterEditor`
to use valid Razor fragment syntax (`=> @<...>`) or convert them fully to
explicit `RenderTreeBuilder` implementation. Keep the existing behavior for
grouped rows, subgroup recursion, and filter rendering, but ensure the fragment
declarations are compiler-safe and consistent with the rest of the component.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor`:
- Around line 7-13: The grid cell key handling in BitDataGridCell.razor
currently only wires HandleKeyDown, so the logic in HandleKeyDown and the
related key paths cannot suppress native browser actions. Restore key-aware
preventDefault behavior for the grid-owned keys handled in the cell, likely by
moving suppression into the TS layer used by the cell instead of relying on the
Razor event binding alone, and ensure Enter, Escape, and navigation keys do not
also trigger browser submit, newline, or scrolling behavior.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs`:
- Around line 21-35: The fallback in BitDataGridValueComparer is collapsing
non-IComparable same-type objects into one value by using type name plus
ToString() in the comparison and hash paths, so unrelated rows can be treated as
equal. Update the comparer logic in BitDataGridValueComparer to avoid relying on
default object.ToString() for unsupported types: either reject/skip grouping and
sorting for such values or only apply the fallback when the type provides a
meaningful ToString() override, and make the hash implementation match the same
rule.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f4eadcde-7f17-4a3f-b8ba-188eeee7085f
📒 Files selected for processing (90)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (10)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor (1)
7-13: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftRestore key-specific default suppression for grid-owned keys.
Line 13 no longer suppresses native key behavior, but Lines 57-65 and Line 70 still handle
Escape/Enterand navigation keys. That lets the browser/input default run alongside the grid again (page scroll, form submit/newline, etc.). This needs key-aware suppression for only the keys the grid owns, likely via the JS layer rather than a blanket Blazor modifier soTabstill escapes normally.Also applies to: 49-70
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor` around lines 7 - 13, Restore key-specific suppression in BitDataGridCell so only grid-owned keys prevent native behavior: the current `@onkeydown` wiring on the cell still lets browser defaults run while HandleKeyDown processes Escape/Enter and navigation keys. Update BitDataGridCell.razor and the related key handling path in HandleKeyDown/keyboard JS interop so suppression is applied only for the keys the grid owns, not as a blanket modifier, and keep Tab allowed to move focus out normally.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs (1)
134-143: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winMatch edited rows by
Id, not by reference.Line 136 and Line 142 still use
Contains/Remove, so cloned edit models will insert duplicates and fail to delete the original row.Suggested fix
private void OnSave(Product p) { - if (!editProducts.Contains(p)) editProducts.Insert(0, p); + var existingIndex = editProducts.FindIndex(x => x.Id == p.Id); + if (existingIndex >= 0) + { + editProducts[existingIndex] = p; + } + else + { + editProducts.Insert(0, p); + } editStatus = $"Saved {p.Name} (#{p.Id})."; } private void OnDelete(Product p) { - editProducts.Remove(p); + editProducts.RemoveAll(x => x.Id == p.Id); editStatus = $"Deleted #{p.Id}."; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs` around lines 134 - 143, The row matching in OnSave and OnDelete still relies on object reference through editProducts.Contains and editProducts.Remove, so cloned Product edit models will be treated as different rows. Update these methods in BitDataGridDemo to locate existing items by Product.Id instead of using reference equality, then insert or remove the matching item from editProducts and keep editStatus unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs`:
- Around line 261-271: The filtering logic in BitDataGridDataProcessor should
not use BitDataGridValueComparer.Instance.Compare as a fallback when
CoerceToValueType cannot produce a valid operand. Update the comparison path
around TryDateOnlyEquals and the subsequent cmp assignment so malformed
numeric/date/Guid filter values are treated as invalid comparisons instead of
being compared as mixed types or strings. Make the change in the main filter
evaluation flow and in the shared coercion/comparison helpers (including the
path used by the later comparison block) so Equals, GreaterThan, and LessThan
all fail closed when coercion returns an unusable value.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor`:
- Around line 7-13: Restore key-specific suppression in BitDataGridCell so only
grid-owned keys prevent native behavior: the current `@onkeydown` wiring on the
cell still lets browser defaults run while HandleKeyDown processes Escape/Enter
and navigation keys. Update BitDataGridCell.razor and the related key handling
path in HandleKeyDown/keyboard JS interop so suppression is applied only for the
keys the grid owns, not as a blanket modifier, and keep Tab allowed to move
focus out normally.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 134-143: The row matching in OnSave and OnDelete still relies on
object reference through editProducts.Contains and editProducts.Remove, so
cloned Product edit models will be treated as different rows. Update these
methods in BitDataGridDemo to locate existing items by Product.Id instead of
using reference equality, then insert or remove the matching item from
editProducts and keep editStatus unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 25a2b10f-37de-4b47-962d-d989ac120728
📒 Files selected for processing (90)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (10)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (2)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cs (1)
154-159: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winGuard
Dispose()with_registeredId.Lines 154-158 correctly leave
_registeredIdnull whenAddColumnrejects a duplicate, but Line 217 still unregisters the instance unconditionally. That lets a never-registered duplicate interfere with the real column owner during disposal.Proposed fix
- public void Dispose() => Grid?.RemoveColumn(this); + public void Dispose() + { + if (_registeredId is not null) + Grid?.RemoveColumn(this); + }Also applies to: 217-217
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cs` around lines 154 - 159, Dispose handling in BitDataGridColumn should only unregister columns that were actually accepted by Grid.AddColumn. Update Dispose() to check _registeredId before calling the grid’s unregister/remove path so duplicate columns that never registered cannot affect the real owner. Use the existing _registeredId flow established in BitDataGridColumn.AddColumn/SnapshotSemanticParameters to gate the cleanup logic.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs (1)
8-13: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDon't treat
ValueType.ToString()as meaningful.
HasMeaningfulToStringonly filters outobject.ToString(), so plain structs that inheritSystem.ValueType.ToString()still go down the text fallback. That makes distinct non-IComparablestruct values compare equal and hash to the same bucket purely because they stringify to the type name.Proposed fix
internal static bool HasMeaningfulToString(Type type) - => type.GetMethod(nameof(ToString), Type.EmptyTypes)?.DeclaringType != typeof(object); + { + var declaringType = type.GetMethod(nameof(ToString), Type.EmptyTypes)?.DeclaringType; + return declaringType is not null + && declaringType != typeof(object) + && declaringType != typeof(ValueType); + }Also applies to: 45-46, 76-78
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs` around lines 8 - 13, Update HasMeaningfulToString in BitDataGridValueComparer so it does not treat the inherited ValueType.ToString() on structs as a meaningful fallback; only return true when the runtime type actually overrides ToString itself. Adjust the equality and ordering fallback paths in BitDataGridValueComparer that rely on HasMeaningfulToString so plain structs do not collapse to the same string-based key and hash bucket.
🧹 Nitpick comments (2)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cs (1)
29-35: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftKeep the group collections read-only at the public boundary.
Items,SubGroups, andAggregatesare mutableList<>s on a new public contract. That makes it easy for callers to mutate the materialized tree after creation and desyncCount/HasSubGroupsfrom what the renderer and collapse-state logic consume. Prefer exposingIReadOnlyList<>(or another read-only wrapper) and keeping mutation inside the processor.Also applies to: 37-40
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cs` around lines 29 - 35, The new public group contract in BitDataGridGroup<TItem> exposes mutable List<> properties for Items, SubGroups, and Aggregates, which should be kept read-only at the boundary; change these members to IReadOnlyList<> (or equivalent read-only wrappers) and keep any mutation/internal list building inside the grouping processor. Update the BitDataGridGroup<TItem> type and any code that constructs or consumes these collections so renderer logic and collapse-state checks continue to use the immutable public shape without allowing external mutation.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs (1)
14-15: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winAlign cache-key casing with path resolution.
Buildresolves segments withBindingFlags.IgnoreCase, butCacheis case-sensitive. Calls like"Address.City"and"address.city"will compile separate accessors for the same logical path, which weakens the cache for callers that vary casing.Suggested change
- private static readonly ConcurrentDictionary<string, BitDataGridPropertyAccessor<TItem>> Cache = new(); + private static readonly ConcurrentDictionary<string, BitDataGridPropertyAccessor<TItem>> Cache = + new(System.StringComparer.OrdinalIgnoreCase);Also applies to: 124-129, 172-173
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs` around lines 14 - 15, The cache in BitDataGridPropertyAccessor<TItem> is using a case-sensitive string key even though Build resolves members with BindingFlags.IgnoreCase, so equivalent paths with different casing create duplicate accessors. Normalize the cache key in the accessor creation flow (for example in Build and any helper that computes the key) so logically identical paths like Address.City and address.city map to the same entry, and keep the cache lookup/insertion consistent with the case-insensitive member resolution.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 126-149: The keydown guard in BitDataGrid.ts only handles the
focused .bit-dtg-cell itself, so interactive descendants inside a tabbable cell
still bubble grid shortcuts into BitDataGridCell.razor’s onkeydown. Update the
listener near the existing cellNavKeys / isSelfManagedEditKeyControl checks to
detect self-managed nested controls inside a grid cell and stop propagation
there as well, so Arrow/Home/End/Page/Enter/F2 stay with the embedded control
instead of triggering grid navigation or edit actions.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cs`:
- Around line 3-4: Update the public XML docs on BitDataGridReadResult to cover
both OnRead and OnLoadMore, and document that TotalCount uses 0 as the “unknown
total” sentinel for infinite scrolling. Adjust the type summary and TotalCount
member/constructor-related docs so the contract matches the existing constructor
logic and the BitDataGridReadResult API surface.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor`:
- Around line 22-45: `LoadingTemplate` is ignored when `Virtualize` is enabled,
so `BitQuickGrid` can end up with no loading UI. Update `BitQuickGrid.razor` and
the related `GridClass()` logic in `BitQuickGrid.razor.cs` so the virtualized
path either renders the provided `LoadingTemplate` through the `Virtualize`
placeholder flow or explicitly disallows/documents the `Virtualize=true` and
`LoadingTemplate!=null` combination. Use the existing `Virtualize`,
`Placeholder`, `LoadingTemplate`, and `GridClass()` symbols to wire the behavior
consistently.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 198-202: The RowTemplate parameter is using the new args type
directly, which breaks compatibility with consumers still expecting the legacy
surface. Update BitQuickGrid.RowTemplate in BitQuickGrid.razor.cs to keep
accepting BitDataGridRowTemplateArgs<TGridItem> (or add an adapter layer that
maps the legacy args to BitQuickGridRowTemplateArgs<TGridItem>) instead of
exposing the new args type outright, and ensure the rest of the component still
renders through the existing row template path.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cs`:
- Around line 224-239: The sample row handling in the BitDataGrid demo is using
reference equality in OnSave and OnDelete even though the grid is keyed by Id,
so edited/copied rows can duplicate or fail to remove. Update the
example4CsharpCode snippet so the save/delete logic in OnSave and OnDelete
locates rows by Product.Id instead of using Contains/Remove on the object
reference, keeping the behavior consistent with KeyField="p => p.Id". Use the
existing CreateProduct, OnSave, and OnDelete methods as the place to align the
sample with key-based matching.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cs`:
- Around line 154-159: Dispose handling in BitDataGridColumn should only
unregister columns that were actually accepted by Grid.AddColumn. Update
Dispose() to check _registeredId before calling the grid’s unregister/remove
path so duplicate columns that never registered cannot affect the real owner.
Use the existing _registeredId flow established in
BitDataGridColumn.AddColumn/SnapshotSemanticParameters to gate the cleanup
logic.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs`:
- Around line 8-13: Update HasMeaningfulToString in BitDataGridValueComparer so
it does not treat the inherited ValueType.ToString() on structs as a meaningful
fallback; only return true when the runtime type actually overrides ToString
itself. Adjust the equality and ordering fallback paths in
BitDataGridValueComparer that rely on HasMeaningfulToString so plain structs do
not collapse to the same string-based key and hash bucket.
---
Nitpick comments:
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cs`:
- Around line 29-35: The new public group contract in BitDataGridGroup<TItem>
exposes mutable List<> properties for Items, SubGroups, and Aggregates, which
should be kept read-only at the boundary; change these members to
IReadOnlyList<> (or equivalent read-only wrappers) and keep any
mutation/internal list building inside the grouping processor. Update the
BitDataGridGroup<TItem> type and any code that constructs or consumes these
collections so renderer logic and collapse-state checks continue to use the
immutable public shape without allowing external mutation.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cs`:
- Around line 14-15: The cache in BitDataGridPropertyAccessor<TItem> is using a
case-sensitive string key even though Build resolves members with
BindingFlags.IgnoreCase, so equivalent paths with different casing create
duplicate accessors. Normalize the cache key in the accessor creation flow (for
example in Build and any helper that computes the key) so logically identical
paths like Address.City and address.city map to the same entry, and keep the
cache lookup/insertion consistent with the case-insensitive member resolution.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 448a428b-5316-41ca-b141-caf45fa6bb28
📒 Files selected for processing (90)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (10)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
♻️ Duplicate comments (4)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs (1)
45-53: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftDon't use hash codes as the comparer's equality key.
Line 52 uses
RuntimeHelpers.GetHashCodeas the fallback ordering key, and Line 79 hashes everyIComparablewithobj.GetHashCode(). Both are weaker than the equality rule here (Compare(...) == 0): identity hashes can collide for distinct references, and customIComparabletypes can legitimately compare equal without sharing a hash code. That makes grouping and hash-based lookups unstable for valid custom cell values. Prefer either rejecting unsupported object types here or deriving both ordering and hashing from one comparer-owned canonical key instead of raw hash codes.Also applies to: 66-83
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs` around lines 45 - 53, The fallback comparison in BitDataGridValueComparer.Compare and the hashing logic in GetHashCode are using raw hash codes as a stand-in for equality, which can collide or disagree with Compare(...) == 0. Update the comparer so unsupported values are either rejected or mapped through a comparer-owned canonical key, and make both ordering and hashing derive from that same key instead of RuntimeHelpers.GetHashCode or obj.GetHashCode. Ensure the Compare and GetHashCode implementations stay consistent for equal values, especially for custom IComparable types and non-IComparable reference types.src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor (1)
22-40: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winHonor
LoadingTemplatewhenVirtualizeis enabled.Lines 22-30 always go through
Placeholder, whileLoadingTemplateis only rendered in the non-virtualized branch at Lines 34-40.Virtualize=truestill leaves callers with the default placeholder rows instead of their custom loading UI.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor` around lines 22 - 40, The virtualized path in BitQuickGrid.razor ignores LoadingTemplate because it always renders the Virtualize Placeholder instead of the caller’s custom loading UI. Update the BitQuickGrid component’s render logic around the Virtualize branch so it honors LoadingTemplate when Virtualize is enabled, using the existing LoadingTemplate/IsLoading handling from the non-virtualized branch and the Virtualize/Placeholder rendering path together.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts (1)
117-127: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winTreat nested
<input>elements as self-managed controls.The nested-control guard still reuses
isSelfManagedEditKeyControl, which excludesINPUT. A focused checkbox/text input inside a templated read-only cell can still bubble Arrow/Home/End/Page/Enter/F2 into the grid shortcut path and lose its native keyboard behavior. Use a separate predicate here so plain edit-row inputs can keep their current Enter/Escape handling.💡 Suggested fix
- function isSelfManagedEditKeyControl(el: HTMLElement): boolean { + function isSelfManagedNestedCellControl(el: HTMLElement): boolean { if (el.isContentEditable) return true; switch (el.tagName) { + case 'INPUT': case 'BUTTON': case 'SELECT': case 'TEXTAREA': case 'A': return true; default: return false; } } @@ - if (ownerCell && ownerCell !== target && nestedControlKeys.has(e.key) && isSelfManagedEditKeyControl(target)) { + if (ownerCell && ownerCell !== target && nestedControlKeys.has(e.key) && isSelfManagedNestedCellControl(target)) { e.stopPropagation(); return; }Also applies to: 145-149
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts` around lines 117 - 127, Treat nested INPUT elements as self-managed controls in the grid keyboard guard. Update the logic around isSelfManagedEditKeyControl and the related shortcut handling in BitDataGrid so nested input elements are excluded from grid key routing, but keep the existing edit-row Enter/Escape behavior by introducing or using a separate predicate for the read-only templated cell path rather than changing the current edit-flow checks.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor (1)
374-466: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winUse supported Razor template syntax for these render fragments.
RenderGroupList,RenderGroup, andRenderFilterEditorstill use the__builder => { <markup> }form. Rewrite them as Razor templates (=> @<text>...</text>) or explicitRenderTreeBuildercode so this compiles reliably.#!/bin/bash # Verify no render-fragment helpers still use the __builder inline-markup form. rg -n "Render(GroupList|Group|FilterEditor).*=> __builder =>" src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 374 - 466, RenderGroupList, RenderGroup, and RenderFilterEditor still use inline markup inside a __builder lambda, which is not the supported Razor template form. Rewrite these helpers in BitDataGrid.razor as proper Razor templates using => @<text>...</text> or convert them to explicit RenderTreeBuilder logic so the markup compiles reliably. Keep the existing behavior and references to RenderGroupList, RenderGroup, RenderFilterEditor, and RenderGroup(group) intact while changing only the render-fragment syntax.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`:
- Around line 374-466: RenderGroupList, RenderGroup, and RenderFilterEditor
still use inline markup inside a __builder lambda, which is not the supported
Razor template form. Rewrite these helpers in BitDataGrid.razor as proper Razor
templates using => @<text>...</text> or convert them to explicit
RenderTreeBuilder logic so the markup compiles reliably. Keep the existing
behavior and references to RenderGroupList, RenderGroup, RenderFilterEditor, and
RenderGroup(group) intact while changing only the render-fragment syntax.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 117-127: Treat nested INPUT elements as self-managed controls in
the grid keyboard guard. Update the logic around isSelfManagedEditKeyControl and
the related shortcut handling in BitDataGrid so nested input elements are
excluded from grid key routing, but keep the existing edit-row Enter/Escape
behavior by introducing or using a separate predicate for the read-only
templated cell path rather than changing the current edit-flow checks.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs`:
- Around line 45-53: The fallback comparison in BitDataGridValueComparer.Compare
and the hashing logic in GetHashCode are using raw hash codes as a stand-in for
equality, which can collide or disagree with Compare(...) == 0. Update the
comparer so unsupported values are either rejected or mapped through a
comparer-owned canonical key, and make both ordering and hashing derive from
that same key instead of RuntimeHelpers.GetHashCode or obj.GetHashCode. Ensure
the Compare and GetHashCode implementations stay consistent for equal values,
especially for custom IComparable types and non-IComparable reference types.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor`:
- Around line 22-40: The virtualized path in BitQuickGrid.razor ignores
LoadingTemplate because it always renders the Virtualize Placeholder instead of
the caller’s custom loading UI. Update the BitQuickGrid component’s render logic
around the Virtualize branch so it honors LoadingTemplate when Virtualize is
enabled, using the existing LoadingTemplate/IsLoading handling from the
non-virtualized branch and the Virtualize/Placeholder rendering path together.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f6fb2ffa-10e4-4eaf-9aa1-00246e039932
📒 Files selected for processing (90)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (10)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (6)
src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss (1)
7-8: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winRemove
.scssextensions from the new imports.Stylelint still reports
scss/load-partial-extensionon both added QuickGrid imports.Proposed fix
-@import "../Components/QuickGrid/BitQuickGrid.scss"; -@import "../Components/QuickGrid/Pagination/BitQuickGridPaginator.scss"; +@import "../Components/QuickGrid/BitQuickGrid"; +@import "../Components/QuickGrid/Pagination/BitQuickGridPaginator";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss` around lines 7 - 8, The new QuickGrid imports in extra-components.scss still use explicit .scss extensions, which triggers the scss/load-partial-extension lint rule. Update the import statements for BitQuickGrid and BitQuickGridPaginator to use partial-style paths without the .scss suffix, keeping the same relative locations so Stylelint no longer flags them.Source: Linters/SAST tools
src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs (1)
201-205: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winCompatibility gap remains for stored legacy row templates.
BitDataGridRowTemplateArgs<T>now derives fromBitQuickGridRowTemplateArgs<T>, but this parameter still acceptsRenderFragment<BitQuickGridRowTemplateArgs<TGridItem>>; storedRenderFragment<BitDataGridRowTemplateArgs<T>>values remain incompatible. Keep the parameter on the legacy args type for the compatibility window, or add an adapter surface.#!/bin/bash # Verify the RowTemplate parameter type and the legacy alias inheritance direction. rg -n "RenderFragment<Bit(Quick|Data)GridRowTemplateArgs|class BitDataGridRowTemplateArgs|class BitQuickGridRowTemplateArgs" \ src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid \ -g '*.cs' -g '*.razor.cs'🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs` around lines 201 - 205, The RowTemplate parameter in BitQuickGrid should preserve compatibility with stored legacy templates, because RenderFragment<BitDataGridRowTemplateArgs<T>> values still cannot be assigned to RenderFragment<BitQuickGridRowTemplateArgs<TGridItem>>. Update BitQuickGrid.razor.cs so the RowTemplate surface stays on the legacy args type during the compatibility window, or introduce an adapter overload/surface that accepts BitDataGridRowTemplateArgs<T> and bridges to the new BitQuickGridRowTemplateArgs<TGridItem> shape. Use BitQuickGridRowTemplateArgs<TGridItem> and BitDataGridRowTemplateArgs<T> as the key symbols when locating the parameter and related template types.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor (3)
374-466: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winUse valid Razor render-fragment syntax here.
These helpers still use
__builder =>with inline markup. Rewrite them as Razor templates (=> @<text>...</text>) or explicitRenderTreeBuildercode so the component compiles reliably. Previously flagged on this file.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 374 - 466, The render helpers in BitDataGrid.razor are using invalid mixed syntax with `__builder =>` and inline markup, which can break compilation. Rewrite `RenderGroupList`, `RenderGroup`, and `RenderFilterEditor` using proper Razor template syntax (`=> @<text>...</text>`) or convert them fully to explicit `RenderTreeBuilder` logic. Keep the existing behavior and references like `RenderGroup`, `RenderGroupList`, and `RenderFilterEditor` intact while changing only the fragment construction.
512-523: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftDon’t send date-only
DateTimeOffsetfiltering as plain equality.Server
OnReadconsumers will seeEqualswith one midnight offset value and cannot infer the client’s “same calendar date in the row’s own offset” special case. Use an explicit date-only/range contract before shipping this API. Previously flagged on this file.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 512 - 523, The DateTimeOffset date-only path in BitDataGrid.razor is using SetFilterAsync with a plain Equals filter on a midnight DateTimeOffset, which server-side OnRead consumers can misinterpret. Update the filtering flow in this branch so it uses an explicit date-only or range contract instead of Equals, and keep the change localized around the DateOnly.TryParse and SetFilterAsync logic in the grid filter handling.
476-490: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winClearing typed filters still creates
Equals null.Blank inputs and parse failures should remove/disable the filter, not filter to only null rows. Return
Unspecifiedor remove the descriptor for whitespace/invalid typed values. Previously flagged on this file.Minimal direction
- if (string.IsNullOrWhiteSpace(raw)) - return SetFilterAsync(column, BitDataGridFilterOperator.Equals, null); + if (string.IsNullOrWhiteSpace(raw)) + return SetFilterAsync(column, BitDataGridFilterOperator.Unspecified, null); ... - catch { return SetFilterAsync(column, BitDataGridFilterOperator.Equals, null); } + catch { return SetFilterAsync(column, BitDataGridFilterOperator.Unspecified, null); }Also applies to: 503-505, 520-525, 538-541
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor` around lines 476 - 490, The typed filter parsing in BitDataGrid.razor is still mapping blank or invalid input to SetFilterAsync(..., Equals, null), which turns a cleared filter into an “is null” filter. Update the typed-input handling in the filter logic around SetFilterAsync, column.EffectiveDataType, and the number/date/time parsing branches so whitespace and parse failures remove or disable the filter instead of creating a null-equality descriptor. Apply the same behavior consistently in the other typed cases referenced by the review so invalid typed values return Unspecified or clear the existing filter descriptor.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor (1)
186-204: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftDon’t infer a browser-entered offset from
TimeZoneInfo.Local.When
Valueis null, this uses the host timezone; in Blazor Server that can be the server timezone, not the user’s browser timezone. Pass the browser offset/timezone into this path or require an existing offset. Previously flagged on this file.In Blazor Server does TimeZoneInfo.Local use the server timezone or the browser user's timezone?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor` around lines 186 - 204, The SetDateTimeOffset path in BitDataGridCellEditor is inferring a timezone from TimeZoneInfo.Local when Value is null, which can use the server timezone instead of the browser’s timezone in Blazor Server. Update this logic to avoid deriving the offset locally; instead, pass the browser offset/timezone into SetDateTimeOffset or only use the existing DateTimeOffset.Value offset when available, and keep the existing DateTimeOffset handling and Grid.SetEditValue flow intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 156-159: The keydown guard in BitDataGrid’s document-level capture
handler is blocking nested controls before their own handlers run. Update the
logic around the ownerCell check in the grid’s key handling flow so embedded
interactive descendants are excluded earlier, or move the stopPropagation
decision to a later stage after descendant handlers have had a chance to process
the event. Make the fix in the handler that uses nestedControlKeys and
isSelfManagedCellKeyControl.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cs`:
- Around line 3-6: Update the XML summary on BitDataGridReadRequest to mention
that this public contract is used by both OnRead and OnLoadMore, since the type
is consumed by the grid’s load-more flow as well as server-side reading. Keep
the wording in BitDataGridReadRequest focused on the payload’s purpose and
ensure the summary reflects the full API surface exposed through
BitDataGrid.razor.cs so IntelliSense no longer implies OnLoadMore is
unsupported.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cs`:
- Around line 585-589: The setter for the virtual sample name filter in
BitQuickGridDemo should not dereference the `@ref-backed` dataGrid
unconditionally. Update the setter to use the same null-safe pattern already
used in ODataSampleNameFilter and example3CsharpCode, so RefreshDataAsync is
only invoked when dataGrid has been assigned after render.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`:
- Around line 374-466: The render helpers in BitDataGrid.razor are using invalid
mixed syntax with `__builder =>` and inline markup, which can break compilation.
Rewrite `RenderGroupList`, `RenderGroup`, and `RenderFilterEditor` using proper
Razor template syntax (`=> @<text>...</text>`) or convert them fully to explicit
`RenderTreeBuilder` logic. Keep the existing behavior and references like
`RenderGroup`, `RenderGroupList`, and `RenderFilterEditor` intact while changing
only the fragment construction.
- Around line 512-523: The DateTimeOffset date-only path in BitDataGrid.razor is
using SetFilterAsync with a plain Equals filter on a midnight DateTimeOffset,
which server-side OnRead consumers can misinterpret. Update the filtering flow
in this branch so it uses an explicit date-only or range contract instead of
Equals, and keep the change localized around the DateOnly.TryParse and
SetFilterAsync logic in the grid filter handling.
- Around line 476-490: The typed filter parsing in BitDataGrid.razor is still
mapping blank or invalid input to SetFilterAsync(..., Equals, null), which turns
a cleared filter into an “is null” filter. Update the typed-input handling in
the filter logic around SetFilterAsync, column.EffectiveDataType, and the
number/date/time parsing branches so whitespace and parse failures remove or
disable the filter instead of creating a null-equality descriptor. Apply the
same behavior consistently in the other typed cases referenced by the review so
invalid typed values return Unspecified or clear the existing filter descriptor.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor`:
- Around line 186-204: The SetDateTimeOffset path in BitDataGridCellEditor is
inferring a timezone from TimeZoneInfo.Local when Value is null, which can use
the server timezone instead of the browser’s timezone in Blazor Server. Update
this logic to avoid deriving the offset locally; instead, pass the browser
offset/timezone into SetDateTimeOffset or only use the existing
DateTimeOffset.Value offset when available, and keep the existing DateTimeOffset
handling and Grid.SetEditValue flow intact.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 201-205: The RowTemplate parameter in BitQuickGrid should preserve
compatibility with stored legacy templates, because
RenderFragment<BitDataGridRowTemplateArgs<T>> values still cannot be assigned to
RenderFragment<BitQuickGridRowTemplateArgs<TGridItem>>. Update
BitQuickGrid.razor.cs so the RowTemplate surface stays on the legacy args type
during the compatibility window, or introduce an adapter overload/surface that
accepts BitDataGridRowTemplateArgs<T> and bridges to the new
BitQuickGridRowTemplateArgs<TGridItem> shape. Use
BitQuickGridRowTemplateArgs<TGridItem> and BitDataGridRowTemplateArgs<T> as the
key symbols when locating the parameter and related template types.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss`:
- Around line 7-8: The new QuickGrid imports in extra-components.scss still use
explicit .scss extensions, which triggers the scss/load-partial-extension lint
rule. Update the import statements for BitQuickGrid and BitQuickGridPaginator to
use partial-style paths without the .scss suffix, keeping the same relative
locations so Stylelint no longer flags them.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 063e7003-07c1-4e5e-8b14-30eaa344ace8
📒 Files selected for processing (90)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (10)
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (4)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs (1)
134-143: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winMatch edited rows by
Id, not by object reference.Line 136 and Line 142 still rely on
List<Product>.Contains/Remove, so any save/delete path that hands back a differentProductinstance for the same row can duplicate the item or fail to remove it. Resolve the target row byIdin both handlers.Suggested fix
private void OnSave(Product p) { - if (!editProducts.Contains(p)) editProducts.Insert(0, p); + var existingIndex = editProducts.FindIndex(x => x.Id == p.Id); + if (existingIndex >= 0) + { + editProducts[existingIndex] = p; + } + else + { + editProducts.Insert(0, p); + } editStatus = $"Saved {p.Name} (#{p.Id})."; } private void OnDelete(Product p) { - editProducts.Remove(p); + editProducts.RemoveAll(x => x.Id == p.Id); editStatus = $"Deleted #{p.Id}."; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs` around lines 134 - 143, The row update handlers currently match products by object reference, which can cause duplicate saved rows or failed deletions when a different Product instance represents the same item. Update OnSave and OnDelete to locate the existing entry in editProducts by comparing Product.Id, then replace or remove that matched item instead of using Contains/Remove directly. Keep the logic localized to the OnSave and OnDelete methods so the grid consistently targets the correct row by identifier.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor (1)
191-197: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftDon't derive a new
DateTimeOffsetfromTimeZoneInfo.Localhere.When
Valueis null, Line 197 uses the host timezone for the fallback offset. In Blazor Server that is the server's timezone, so a browser-entereddatetime-localcan be saved with the wrong offset/instant. This path needs a browser-provided offset/timezone instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor` around lines 191 - 197, The fallback offset logic in SetDateTimeOffset should not use TimeZoneInfo.Local when Value is null, because that ties browser-entered datetime-local values to the server timezone. Update the SetDateTimeOffset path in BitDataGridCellEditor.razor to use a browser-provided offset or timezone instead of deriving a new DateTimeOffset from the local host, while keeping the existing current.Value offset behavior when Value is already a DateTimeOffset.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor (1)
13-13: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftReintroduce default suppression for the keys the grid handles.
With no
@onkeydown:preventDefaulton Line 13, the browser's native behavior still runs for keys consumed byHandleKeyDown. That means arrow/page navigation can scroll the page while focus moves, andEnter/Escapein edit mode can still trigger native control or form behavior alongside commit/cancel. KeepTabuntouched, but suppress the grid-owned keys again.Also applies to: 49-70
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor` at line 13, The grid cell key handling in BitDataGridCell.razor is missing default suppression for keys consumed by HandleKeyDown, so restore `@onkeydown`:preventDefault for the grid-owned keys while leaving Tab behavior unchanged. Update the keydown handling around HandleKeyDown in BitDataGridCell so arrow/page navigation and edit-mode Enter/Escape do not also trigger native browser, control, or form behavior, but preserve Tab’s default handling.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts (1)
156-159: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep nested-control key events out of the document capture stop path.
This still calls
stopPropagation()from a document capture listener, so target/custom key handlers can be skipped before the control sees the event. Move this suppression to a bubble/per-cell path, or make the Blazor cell handler ignore interactive descendants instead. This repeats the earlier capture-phase finding.DOM Event stopPropagation called during document capture phase does the event reach target listeners?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts` around lines 156 - 159, The document-capture key handling in BitDataGrid.ts still stops propagation too early, which can bypass target/custom handlers on nested controls. Update the ownerCell/target key suppression path in the BitDataGrid listener logic so nested-control keys are filtered in a bubble/per-cell handler instead of calling stopPropagation() from the document capture listener, or adjust the Blazor cell handler to ignore interactive descendants; keep the fix centered around the existing nestedControlKeys and isSelfManagedCellKeyControl checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razor`:
- Around line 4-6: The row container in BitDataGridRow.razor only reflects
selection through RowClass, so assistive technologies cannot detect when a row
is selected. Update the main row element rendered by BitDataGridRow to bind
aria-selected to the existing Selected state whenever row selection is enabled,
using the same selection logic already used for RowClass/OnRowClick so the
screen reader state stays in sync with user interaction.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cs`:
- Around line 13-22: The event args currently expose ColumnId and ColumnTitle as
live getters off BitDataGridColumn<TItem>, which can change after dispatch and
make the payload inconsistent. Update BitDataGridCellEventArgs to snapshot the
column metadata when the instance is created, preferably in the constructor or
init path where the event args are built, and keep Column only as the live
reference. Use the existing BitDataGridCellEventArgs and
BitDataGridColumn<TItem> members to store immutable ColumnId and ColumnTitle
values at event-time so async handlers always see a consistent payload.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor`:
- Around line 24-29: The loading row in BitQuickGrid.razor is using a hardcoded
colspan value, which can overspan the table and misalign the layout. Update the
loading template rows in BitQuickGrid to use the actual collected column count
instead of 100, reusing the same column-count logic already available in the
component so both loading-row branches stay consistent.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cs`:
- Around line 26-35: `BitQuickGrid<T>.RowTemplate` is still too narrow because
the legacy `BitDataGridRowTemplateArgs<T>` alias does not satisfy the
`RenderFragment<T>` variance mismatch. Update the `RowTemplate` API in
`BitQuickGrid<T>` so existing callers can continue passing
`RenderFragment<BitDataGridRowTemplateArgs<T>>`, either by keeping the legacy
delegate type on the parameter or by adding a compatible overload/adapter that
maps `BitDataGridRowTemplateArgs<T>` to `BitQuickGridRowTemplateArgs<T>`.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 156-159: The document-capture key handling in BitDataGrid.ts still
stops propagation too early, which can bypass target/custom handlers on nested
controls. Update the ownerCell/target key suppression path in the BitDataGrid
listener logic so nested-control keys are filtered in a bubble/per-cell handler
instead of calling stopPropagation() from the document capture listener, or
adjust the Blazor cell handler to ignore interactive descendants; keep the fix
centered around the existing nestedControlKeys and isSelfManagedCellKeyControl
checks.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razor`:
- Line 13: The grid cell key handling in BitDataGridCell.razor is missing
default suppression for keys consumed by HandleKeyDown, so restore
`@onkeydown`:preventDefault for the grid-owned keys while leaving Tab behavior
unchanged. Update the keydown handling around HandleKeyDown in BitDataGridCell
so arrow/page navigation and edit-mode Enter/Escape do not also trigger native
browser, control, or form behavior, but preserve Tab’s default handling.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razor`:
- Around line 191-197: The fallback offset logic in SetDateTimeOffset should not
use TimeZoneInfo.Local when Value is null, because that ties browser-entered
datetime-local values to the server timezone. Update the SetDateTimeOffset path
in BitDataGridCellEditor.razor to use a browser-provided offset or timezone
instead of deriving a new DateTimeOffset from the local host, while keeping the
existing current.Value offset behavior when Value is already a DateTimeOffset.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cs`:
- Around line 134-143: The row update handlers currently match products by
object reference, which can cause duplicate saved rows or failed deletions when
a different Product instance represents the same item. Update OnSave and
OnDelete to locate the existing entry in editProducts by comparing Product.Id,
then replace or remove that matched item instead of using Contains/Remove
directly. Keep the logic localized to the OnSave and OnDelete methods so the
grid consistently targets the correct row by identifier.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1e922ef0-8e8c-469b-9927-1f1ba598f15b
📒 Files selected for processing (90)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (10)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cs
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (3)
src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cs (1)
3-6: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winKeep an obsolete shim for
BitDataGridPaginationState.This public rename still breaks existing consumers that instantiate
BitDataGridPaginationState, and this PR already uses an[Obsolete]forwarder for the similarBitDataGridTemplateColumn<TGridItem>rename. Please keep the old pagination-state name as a temporary alias too.Compatibility patch
public class BitQuickGridPaginationState { @@ } + +[Obsolete("BitDataGridPaginationState has been renamed to BitQuickGridPaginationState. Use BitQuickGridPaginationState instead.")] +public class BitDataGridPaginationState : BitQuickGridPaginationState +{ +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cs` around lines 3 - 6, The pagination state rename breaks existing consumers that still construct BitDataGridPaginationState, so keep a temporary obsolete shim alongside BitQuickGridPaginationState. Add a public BitDataGridPaginationState alias/forwarder in the same QuickGrid pagination area, mark it [Obsolete] like the existing BitDataGridTemplateColumn<TGridItem> compatibility pattern, and have it delegate to or inherit from BitQuickGridPaginationState so older code continues to compile without behavioral changes.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs (1)
269-271: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winFail closed for malformed
NotEqualsoperands.A bad comparable value still returns
trueforNotEquals, so filters likePrice != abcmatch every row instead of being treated as invalid.Suggested fix
- if (!TryCoerceToValueType(value, filter.Value, out var operand)) - { - return filter.Operator is BitDataGridFilterOperator.NotEquals; - } + if (!TryCoerceToValueType(value, filter.Value, out var operand)) + return false;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs` around lines 269 - 271, The malformed operand handling in BitDataGridDataProcessor.TryCoerceToValueType currently treats NotEquals as a match even when coercion fails, which causes invalid filters like Price != abc to pass. Update the filter evaluation logic in the BitDataGridDataProcessor path so coercion failure fails closed for BitDataGridFilterOperator.NotEquals as well, returning a non-match for invalid operands instead of matching every row.src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts (1)
156-179: 🎯 Functional Correctness | 🟠 MajorThe document-capture guard still breaks nested control key handling.
Line 158 stops propagation during the
documentcapture phase, soEnter/navigation/F2 never reach the nested control’s own handlers.Escapeis still not really exempt either: Line 179 returns without stopping propagation, so it can still bubble intoBitDataGridCell.HandleKeyDownand cancel the grid edit. Please move this exemption out of the document capture path, or make the cell/grid handler ignore self-managed descendant targets instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts` around lines 156 - 179, The key handling in BitDataGrid’s document-capture path is still intercepting self-managed nested controls, so their own keyboard handlers never get a chance to run and Escape can still reach the grid edit logic. Update the keyboard guard in BitDataGrid.ts so the document-level listener does not stop propagation for targets recognized by isSelfManagedCellKeyControl or isSelfManagedEditKeyControl, and instead have BitDataGridCell.HandleKeyDown ignore those descendant targets when deciding whether to process Enter, Escape, navigation, or F2.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`:
- Around line 386-401: The group-row markup in BitDataGrid.razor is using
bit-dtg-group-cell with full-width spanning styles outside the normal
.bit-dtg-row grid, so it should be wrapped in the same row shell used by other
full-width rows. Update the group rendering in the group row template around the
ToggleGroup button, group header, and aggregates so it uses the existing
.bit-dtg-row structure and grid-template-columns context, keeping the
bit-dtg-group-row/bit-dtg-group-cell content aligned with the rest of the grid.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs`:
- Around line 47-48: The same-type IComparable fast path in
BitDataGridValueComparer currently treats CompareTo == 0 as equality while
GetHashCode still uses the raw object hash, so custom comparables can be grouped
inconsistently. Update the comparer logic around the IComparable branch and the
GetHashCode path to either restrict this optimization to known scalar/BCL types
or compute both equality and hashing from the same normalized projection for
arbitrary IComparable values. Make sure the changes are applied consistently in
the comparer methods that handle comparison and hashing so equal values always
produce matching hash behavior.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`:
- Around line 475-523: The refresh flow in BitQuickGrid.razor.cs leaves the
pagination snapshot stale when Virtualize is enabled, which can cause a
duplicate initial query after the rerender. Update the refresh logic around the
method that sets _lastRefreshedVirtualize so ComputePaginationStateHash() is
recorded before both the virtualized and non-virtualized branches, ensuring
OnParametersSetAsync and ProvideVirtualizedItems see the same requested slice
and do not reissue the same load.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cs`:
- Around line 6-9: `BitQuickGridDefer` was renamed publicly, which breaks
downstream callers that still reference `BitDataGridDefer`; keep a compatibility
shim instead of only exposing the new type. Update the `BitQuickGridDefer` class
to serve as an obsolete forwarding type, matching the other renamed QuickGrid
helpers in this PR, and preserve the old `BitDataGridDefer` symbol so existing
code continues to compile. Make sure the obsolete wrapper points to the new
implementation and remains `public` for compatibility.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cs`:
- Around line 128-135: Document the infinite-scroll sentinel on
BitDataGridReadResult<TItem> by updating the metadata in
BitDataGridDemo.razor.params.cs so the TotalCount parameter explicitly states
that 0 means “unknown total” for OnLoadMore/load-more batches. Keep the existing
description about infinite mode, but add the sentinel contract near the
BitDataGridReadResult entry so the generated demo docs reflect the behavior of
OnLoadMore and OnRead consistently.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.ts`:
- Around line 156-179: The key handling in BitDataGrid’s document-capture path
is still intercepting self-managed nested controls, so their own keyboard
handlers never get a chance to run and Escape can still reach the grid edit
logic. Update the keyboard guard in BitDataGrid.ts so the document-level
listener does not stop propagation for targets recognized by
isSelfManagedCellKeyControl or isSelfManagedEditKeyControl, and instead have
BitDataGridCell.HandleKeyDown ignore those descendant targets when deciding
whether to process Enter, Escape, navigation, or F2.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cs`:
- Around line 269-271: The malformed operand handling in
BitDataGridDataProcessor.TryCoerceToValueType currently treats NotEquals as a
match even when coercion fails, which causes invalid filters like Price != abc
to pass. Update the filter evaluation logic in the BitDataGridDataProcessor path
so coercion failure fails closed for BitDataGridFilterOperator.NotEquals as
well, returning a non-match for invalid operands instead of matching every row.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cs`:
- Around line 3-6: The pagination state rename breaks existing consumers that
still construct BitDataGridPaginationState, so keep a temporary obsolete shim
alongside BitQuickGridPaginationState. Add a public BitDataGridPaginationState
alias/forwarder in the same QuickGrid pagination area, mark it [Obsolete] like
the existing BitDataGridTemplateColumn<TGridItem> compatibility pattern, and
have it delegate to or inherit from BitQuickGridPaginationState so older code
continues to compile without behavioral changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c5953fcf-426f-4d57-9b38-05a83c1be809
📒 Files selected for processing (90)
src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCell.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridCellEditor.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRow.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridDataProcessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridGroup.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridPropertyAccessor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridAggregateType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridCellEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridColumnDataType.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridFilterOperator.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridGroupDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridPagerPosition.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridReadResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridRowReorderEventArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSelectionMode.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDescriptor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Models/BitDataGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.tssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridRowTemplateArgs.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGridSortDirection.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridAlign.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridColumnBase.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridPropertyColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridSort.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/BitQuickGridTemplateColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Columns/IBitQuickGridSortBuilderColumn.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridColumnsCollectedNotifier.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscribable.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventCallbackSubscriber.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/EventHandlers.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/IAsyncQueryExecutor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/InternalGridContext.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProvider.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderRequest.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/ItemsProvider/BitQuickGridItemsProviderResult.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginationState.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razorsrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.razor.cssrc/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Pagination/BitQuickGridPaginator.scsssrc/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scsssrc/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/AppJsonContext.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecall.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/FoodRecallQueryResult.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Meta.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Openfda.cssrc/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/QuickGridDemo/Results.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/FileSystemData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/Product.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SampleData.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/SupplierModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/BitQuickGridDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/CountryModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/QuickGrid/MedalsModel.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json
💤 Files with no reviewable changes (10)
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProvider.cs
- src/BlazorUI/Bit.BlazorUI/Utils/BitDirection.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridJsRuntimeExtensions.cs
- src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Dtos/DataGridDemo/Openfda.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/IBitDataGridSortBuilderColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridColumnBase.razor.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridPropertyColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/ItemsProvider/BitDataGridItemsProviderResult.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Columns/BitDataGridTemplateColumn.cs
- src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGridRowTemplateArgs.cs
| <div class="bit-dtg-group-row" role="row" style="--bit-dtg-group-level:@group.Level;"> | ||
| <div class="bit-dtg-group-cell" role="gridcell" style="padding-inline-start:@(8 + group.Level * 20)px;"> | ||
| <button type="button" class="bit-dtg-icon-btn" | ||
| aria-label="@($"{(collapsed ? "Expand" : "Collapse")} group {groupCol?.DisplayTitle}: {group.KeyText}")" | ||
| aria-expanded="@(collapsed ? "false" : "true")" | ||
| @onclick="() => ToggleGroup(group)"> | ||
| @(collapsed ? "▸" : "▾") | ||
| </button> | ||
| <strong>@(groupCol?.DisplayTitle): @group.KeyText</strong> | ||
| <span class="bit-dtg-group-count">(@group.Count)</span> | ||
| @foreach (var agg in group.Aggregates) | ||
| { | ||
| <span class="bit-dtg-group-agg">@(_columnsById.GetValueOrDefault(agg.ColumnId)?.DisplayTitle): @AggregateLabel(agg)</span> | ||
| } | ||
| </div> | ||
| </div> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Render group rows on the grid template.
bit-dtg-group-cell uses grid-column: 1 / -1, but its parent is not a .bit-dtg-row grid and has no grid-template-columns, so the spanning cell styling is ineffective. Use the same row shell as the other full-width rows.
Proposed fix
- <div class="bit-dtg-group-row" role="row" style="--bit-dtg-group-level:`@group.Level`;">
+ <div class="bit-dtg-row bit-dtg-group-row" role="row" style="grid-template-columns:var(--bit-dtg-template);--bit-dtg-group-level:`@group.Level`;">📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <div class="bit-dtg-group-row" role="row" style="--bit-dtg-group-level:@group.Level;"> | |
| <div class="bit-dtg-group-cell" role="gridcell" style="padding-inline-start:@(8 + group.Level * 20)px;"> | |
| <button type="button" class="bit-dtg-icon-btn" | |
| aria-label="@($"{(collapsed ? "Expand" : "Collapse")} group {groupCol?.DisplayTitle}: {group.KeyText}")" | |
| aria-expanded="@(collapsed ? "false" : "true")" | |
| @onclick="() => ToggleGroup(group)"> | |
| @(collapsed ? "▸" : "▾") | |
| </button> | |
| <strong>@(groupCol?.DisplayTitle): @group.KeyText</strong> | |
| <span class="bit-dtg-group-count">(@group.Count)</span> | |
| @foreach (var agg in group.Aggregates) | |
| { | |
| <span class="bit-dtg-group-agg">@(_columnsById.GetValueOrDefault(agg.ColumnId)?.DisplayTitle): @AggregateLabel(agg)</span> | |
| } | |
| </div> | |
| </div> | |
| <div class="bit-dtg-row bit-dtg-group-row" role="row" style="grid-template-columns:var(--bit-dtg-template);--bit-dtg-group-level:`@group.Level`;"> | |
| <div class="bit-dtg-group-cell" role="gridcell" style="padding-inline-start:@(8 + group.Level * 20)px;"> | |
| <button type="button" class="bit-dtg-icon-btn" | |
| aria-label="@($"{(collapsed ? "Expand" : "Collapse")} group {groupCol?.DisplayTitle}: {group.KeyText}")" | |
| aria-expanded="@(collapsed ? "false" : "true")" | |
| `@onclick`="() => ToggleGroup(group)"> | |
| @(collapsed ? "▸" : "▾") | |
| </button> | |
| <strong>@(groupCol?.DisplayTitle): `@group.KeyText`</strong> | |
| <span class="bit-dtg-group-count">(`@group.Count`)</span> | |
| `@foreach` (var agg in group.Aggregates) | |
| { | |
| <span class="bit-dtg-group-agg">@(_columnsById.GetValueOrDefault(agg.ColumnId)?.DisplayTitle): `@AggregateLabel`(agg)</span> | |
| } | |
| </div> | |
| </div> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.razor`
around lines 386 - 401, The group-row markup in BitDataGrid.razor is using
bit-dtg-group-cell with full-width spanning styles outside the normal
.bit-dtg-row grid, so it should be wrapped in the same row shell used by other
full-width rows. Update the group rendering in the group row template around the
ToggleGroup button, group header, and aggregates so it uses the existing
.bit-dtg-row structure and grid-template-columns context, keeping the
bit-dtg-group-row/bit-dtg-group-cell content aligned with the rest of the grid.
| if (x is IComparable cx && x.GetType() == y.GetType()) | ||
| return cx.CompareTo(y); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
CompareTo-based equality and hashing diverge for custom comparables.
Lines 47-48 treat any same-type IComparable pair with CompareTo == 0 as equal, but Line 95 still hashes them with obj.GetHashCode(). That only holds for types whose hash/equality semantics are guaranteed to match their comparison semantics. For user-defined comparables that sort on a subset or normalized view, grouping and hash-based lookups can split values the grid considers equal. Restrict this fast path to known scalar/BCL types, or derive both equality and hashing from one shared projection for arbitrary IComparable values.
Also applies to: 81-98
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Infrastructure/BitDataGridValueComparer.cs`
around lines 47 - 48, The same-type IComparable fast path in
BitDataGridValueComparer currently treats CompareTo == 0 as equality while
GetHashCode still uses the raw object hash, so custom comparables can be grouped
inconsistently. Update the comparer logic around the IComparable branch and the
GetHashCode path to either restrict this optimization to known scalar/BCL types
or compute both equality and hashing from the same normalized projection for
arbitrary IComparable values. Make sure the changes are applied consistently in
the comparer methods that handle comparison and hashing so equal values always
produce matching hash behavior.
| _lastRefreshedVirtualize = Virtualize; | ||
|
|
||
| // Move into a "loading" state, cancelling any earlier-but-still-pending load. Do NOT dispose | ||
| // the previous source here: the load that owns it may still be in flight and holding its token | ||
| // (e.g. registered on it), so disposing now could surface an ObjectDisposedException instead of | ||
| // the expected OperationCanceledException. Each load disposes its own source in its finally block | ||
| // once it has finished using it (whether or not it is still the current one), so a superseded | ||
| // source is disposed by its owning load rather than leaked to the GC. | ||
| _pendingDataLoadCancellationTokenSource?.Cancel(); | ||
| var thisLoadCts = _pendingDataLoadCancellationTokenSource = new CancellationTokenSource(); | ||
|
|
||
| // Render now so the loading state (IsLoading / LoadingTemplate) becomes visible as soon as the | ||
| // refresh starts, instead of only after the async load below completes. | ||
| StateHasChanged(); | ||
|
|
||
| if (Virtualize) | ||
| { | ||
| // If we're using Virtualize, we have to go through its RefreshDataAsync API otherwise: | ||
| // (1) It won't know to update its own internal state if the provider output has changed | ||
| // (2) We won't know what slice of data to query for | ||
| // The reference can still be null before it's captured (first render) or right after toggling | ||
| // virtualization on; in that case Virtualize will request its own items once it renders, so we | ||
| // just reconcile the load-state here. The non-virtualized provider request must never run for a | ||
| // virtualized grid. | ||
| try | ||
| { | ||
| if (_virtualizeComponent is not null) | ||
| { | ||
| await _virtualizeComponent.RefreshDataAsync(); | ||
| } | ||
| } | ||
| finally | ||
| { | ||
| // Always reconcile the load-state, even if RefreshDataAsync threw, so we don't leak the | ||
| // CTS or leave _pendingDataLoadCancellationTokenSource pointing at a disposed instance. | ||
| // This load is done with its own source, so dispose it unconditionally; only clear the | ||
| // field when it still points at this source (a newer load may already own it). | ||
| thisLoadCts.Dispose(); | ||
| if (ReferenceEquals(_pendingDataLoadCancellationTokenSource, thisLoadCts)) | ||
| { | ||
| _pendingDataLoadCancellationTokenSource = null; | ||
| } | ||
| } | ||
| } | ||
| else | ||
| { | ||
| // If we're not using Virtualize, we build and execute a request against the items provider directly | ||
| _lastRefreshedPaginationStateHash = ComputePaginationStateHash(); | ||
| var startIndex = Pagination is null ? 0 : (Pagination.CurrentPageIndex * Pagination.ItemsPerPage); |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win
Record the pagination snapshot before entering the virtualized refresh path.
With Virtualize=true, this method updates _lastRefreshedVirtualize but leaves _lastRefreshedPaginationStateHash stale until ProvideVirtualizedItems(...) runs. Because Line 488 already queues another render, the next OnParametersSetAsync() can still see a pagination change and kick off a second initial query for the same page. Move the ComputePaginationStateHash() assignment out of the non-virtualized branch so both refresh paths mark the requested slice before rerendering.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/BitQuickGrid.razor.cs`
around lines 475 - 523, The refresh flow in BitQuickGrid.razor.cs leaves the
pagination snapshot stale when Virtualize is enabled, which can cause a
duplicate initial query after the rerender. Update the refresh logic around the
method that sets _lastRefreshedVirtualize so ComputePaginationStateHash() is
recorded before both the virtualized and non-virtualized branches, ensuring
OnParametersSetAsync and ProvideVirtualizedItems see the same requested slice
and do not reissue the same load.
| /// <summary> | ||
| /// For internal use only. Do not use. | ||
| /// </summary> | ||
| public class BitDataGridDefer : ComponentBase | ||
| public class BitQuickGridDefer : ComponentBase |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Keep BitDataGridDefer as an obsolete forwarding type.
This helper is still public, so renaming it outright is a source-breaking change for any downstream code that referenced BitDataGridDefer. The other renamed QuickGrid helper types in this PR already keep obsolete shims; this one should too.
Proposed compatibility patch
public class BitQuickGridDefer : ComponentBase
{
/// <summary>
/// For internal use only. Do not use.
/// </summary>
[Parameter] public RenderFragment? ChildContent { get; set; }
/// <summary>
/// For internal use only. Do not use.
/// </summary>
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.AddContent(0, ChildContent);
}
}
+
+[Obsolete("BitDataGridDefer has been renamed to BitQuickGridDefer. Use BitQuickGridDefer instead.")]
+public class BitDataGridDefer : BitQuickGridDefer
+{
+}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// <summary> | |
| /// For internal use only. Do not use. | |
| /// </summary> | |
| public class BitDataGridDefer : ComponentBase | |
| public class BitQuickGridDefer : ComponentBase | |
| /// <summary> | |
| /// For internal use only. Do not use. | |
| /// </summary> | |
| public class BitQuickGridDefer : ComponentBase | |
| { | |
| /// <summary> | |
| /// For internal use only. Do not use. | |
| /// </summary> | |
| [Parameter] public RenderFragment? ChildContent { get; set; } | |
| /// <summary> | |
| /// For internal use only. Do not use. | |
| /// </summary> | |
| protected override void BuildRenderTree(RenderTreeBuilder builder) | |
| { | |
| builder.AddContent(0, ChildContent); | |
| } | |
| } | |
| [Obsolete("BitDataGridDefer has been renamed to BitQuickGridDefer. Use BitQuickGridDefer instead.")] | |
| public class BitDataGridDefer : BitQuickGridDefer | |
| { | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/BlazorUI/Bit.BlazorUI.Extras/Components/QuickGrid/Infrastructure/BitQuickGridDefer.cs`
around lines 6 - 9, `BitQuickGridDefer` was renamed publicly, which breaks
downstream callers that still reference `BitDataGridDefer`; keep a compatibility
shim instead of only exposing the new type. Update the `BitQuickGridDefer` class
to serve as an obsolete forwarding type, matching the other renamed QuickGrid
helpers in this PR, and preserve the old `BitDataGridDefer` symbol so existing
code continues to compile. Make sure the obsolete wrapper points to the new
implementation and remains `public` for compatibility.
| Id = "BitDataGridReadResult", | ||
| Title = "BitDataGridReadResult<TItem>", | ||
| Description = "Result returned from a grid's OnRead/OnLoadMore callback.", | ||
| Parameters = | ||
| [ | ||
| new() { Name = "Items", Type = "IReadOnlyList<TItem>", DefaultValue = "", Description = "The items for the current page/window." }, | ||
| new() { Name = "TotalCount", Type = "int", DefaultValue = "", Description = "The total number of items matching the current filters (ignored in infinite mode)." }, | ||
| ], |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the TotalCount == 0 infinite-scroll sentinel here too.
BitDataGridReadResult<TItem> now documents 0 as the "unknown total" value for OnLoadMore, but this metadata only says the total is ignored in infinite mode. The generated demo docs will miss the actual callback contract for non-empty load-more batches.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/DataGrid/BitDataGridDemo.razor.params.cs`
around lines 128 - 135, Document the infinite-scroll sentinel on
BitDataGridReadResult<TItem> by updating the metadata in
BitDataGridDemo.razor.params.cs so the TotalCount parameter explicitly states
that 0 means “unknown total” for OnLoadMore/load-more batches. Keep the existing
description about infinite mode, but add the sentinel contract near the
BitDataGridReadResult entry so the generated demo docs reflect the behavior of
OnLoadMore and OnRead consistently.
closes #12502
Summary by CodeRabbit