diff --git a/CHANGELOG.md b/CHANGELOG.md index ea065c6..1d7a89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **BREAKING**: The single-expression overload of `SortAsync` names its parameter `expression` instead of `expressions`. Only calls that name the argument are affected. - **BREAKING**: `NavigateToAsync` takes its `row` index as an `int` instead of a `long`, like collection indexers and other grids' row-index APIs. Calls passing a `long` need a cast. +### Removed + +- **BREAKING**: The members deprecated in 0.10.0: `GridLiteColumnDataType.Date`, `RenderAsync`, `RefreshAsync`, `UpdateDataAsync` and `GridId`. + ## 0.10.0 - 2026-09-29 This release updates to `igniteui-grid-lite` version `0.11.0` ([see changelog](https://github.com/IgniteUI/igniteui-grid-lite/blob/master/CHANGELOG.md)), which includes 0.10.0. Its changes are marked "grid-lite" below. diff --git a/src/IgniteUI.Blazor.GridLite/IgbGridLite.razor.cs b/src/IgniteUI.Blazor.GridLite/IgbGridLite.razor.cs index a17f460..e8cdf67 100644 --- a/src/IgniteUI.Blazor.GridLite/IgbGridLite.razor.cs +++ b/src/IgniteUI.Blazor.GridLite/IgbGridLite.razor.cs @@ -113,12 +113,6 @@ public partial class IgbGridLite<[DynamicallyAccessedMembers(DynamicallyAccessed // True once the grid has rendered on the client; false if the first render fails or disposal comes first. private readonly TaskCompletionSource clientRender = new(TaskCreationOptions.RunContinuationsAsynchronously); - /// - /// The unique identifier for this grid instance - /// - [Obsolete("The grid's internal id is not needed to use it. It will be removed in a future release.")] - public string GridId => gridId; - /// protected override async Task OnAfterRenderAsync(bool firstRender) { @@ -208,15 +202,6 @@ public override async Task SetParametersAsync(ParameterView parameters) } } - /// - /// Re-renders the grid on the client with the current data and configuration. - /// - [Obsolete("The grid renders on its own and updates from its parameters; assign a new collection instead of changing one in place. It will be removed in a future release.")] - public async Task RenderAsync() - { - await RenderGridAsync(); - } - private async Task RenderGridAsync() { if (jsHandler is null) @@ -268,28 +253,6 @@ private static GridLiteDataPayload CreateDataPayload(IEnumerable? data) return new GridLiteDataPayload(data ?? Array.Empty(), AppValueSerializer.GetDataTypeInfo()); } - /// - /// Refreshes the grid by re-rendering it with the current data and configuration. - /// - [Obsolete("The grid renders on its own and updates from its parameters; assign a new collection instead of changing one in place. It will be removed in a future release.")] - public async Task RefreshAsync() - { - await RenderGridAsync(); - } - - /// - /// Updates the data source for the grid. - /// - /// The new data to display in the grid - [Obsolete("Assign a new collection to the Data parameter instead. It will be removed in a future release.")] - public async Task UpdateDataAsync(IEnumerable newData) - { - ArgumentNullException.ThrowIfNull(newData); - Data = newData; - var json = JsonSerializer.Serialize(newData, AppValueSerializer.GetDataTypeInfo()); - await InvokeVoidJsAsync("blazor_igc_grid_lite.updateData", gridId, json); - } - /// /// Performs a sort operation in the grid based on the passed expression(s). /// diff --git a/src/IgniteUI.Blazor.GridLite/Models/IgbGridLiteColumnConfiguration.cs b/src/IgniteUI.Blazor.GridLite/Models/IgbGridLiteColumnConfiguration.cs index 54b461b..0148acc 100644 --- a/src/IgniteUI.Blazor.GridLite/Models/IgbGridLiteColumnConfiguration.cs +++ b/src/IgniteUI.Blazor.GridLite/Models/IgbGridLiteColumnConfiguration.cs @@ -92,11 +92,4 @@ public enum GridLiteColumnDataType /// / values. Boolean, - - /// - /// The grid-lite web component has no date data type; this value behaves like . - /// It will be removed in a future release. - /// - [Obsolete("The grid-lite web component has no date data type; this value behaves like String. It will be removed in a future release.")] - Date } diff --git a/src/IgniteUI.Blazor.GridLite/igc-grid-lite-entry.js b/src/IgniteUI.Blazor.GridLite/igc-grid-lite-entry.js index 235f5cf..ace4052 100644 --- a/src/IgniteUI.Blazor.GridLite/igc-grid-lite-entry.js +++ b/src/IgniteUI.Blazor.GridLite/igc-grid-lite-entry.js @@ -129,13 +129,6 @@ export const blazor_igc_grid_lite = { } }, - updateData(id, data) { - const grid = this.grids.get(id); - if (grid) { - grid.data = JSON.parse(data); - } - }, - sort(id, expressions) { const grid = this.grids.get(id); if (grid) { diff --git a/tests/IgniteUI.Blazor.GridLite.IntegrationTests/GridLiteTests.cs b/tests/IgniteUI.Blazor.GridLite.IntegrationTests/GridLiteTests.cs index 6bc12a4..a27cd36 100644 --- a/tests/IgniteUI.Blazor.GridLite.IntegrationTests/GridLiteTests.cs +++ b/tests/IgniteUI.Blazor.GridLite.IntegrationTests/GridLiteTests.cs @@ -18,27 +18,6 @@ public async Task GridLite_RendersHeadersAndData() await Expect(grid.GetByText("Chai", new() { Exact = true })).ToBeVisibleAsync(); } - // Without it, each re-render adds another set of listeners and every event reaches .NET once more. - [Test] - public async Task Refresh_DoesNotDuplicateEventCallbacks() - { - await Page.GotoAsync(Host.ServerAddress); - var grid = Page.Locator("igc-grid-lite"); - await Expect(grid.GetByText("Chai", new() { Exact = true })).ToBeVisibleAsync(); - - await Page.Locator("#refresh-button").ClickAsync(); - await Expect(Page.Locator("#refresh-count")).ToHaveTextAsync("1"); - - // grid-lite sorts from the header's sort action, not from its title. - await grid.Locator("igc-grid-lite-header", new() { HasText = "Product Name" }).Locator("[part~='action']").ClickAsync(); - await Expect(Page.Locator("#sorted-count")).ToHaveTextAsync("1"); - - // The circuit handles this click after any duplicate callback the sort click sent before it. - await Page.Locator("#refresh-button").ClickAsync(); - await Expect(Page.Locator("#refresh-count")).ToHaveTextAsync("2"); - await Expect(Page.Locator("#sorted-count")).ToHaveTextAsync("1"); - } - // TODO: grid-lite 0.11.0's client mapping a condition object to its name, remove after it's updated. [Test] public async Task FilteringEvent_WithConditionObject_ReachesDotNetAsItsName() diff --git a/tests/IgniteUI.Blazor.GridLite.TestBed/Components/Pages/GridPage.razor b/tests/IgniteUI.Blazor.GridLite.TestBed/Components/Pages/GridPage.razor index 4403196..61d473a 100644 --- a/tests/IgniteUI.Blazor.GridLite.TestBed/Components/Pages/GridPage.razor +++ b/tests/IgniteUI.Blazor.GridLite.TestBed/Components/Pages/GridPage.razor @@ -3,7 +3,7 @@

GridLite TestBed

- + @@ -19,9 +19,6 @@ DataType="GridLiteColumnDataType.Number" /> - -

@refreshCount

-

@sortedCount

@lastFiltering

@@ -34,8 +31,6 @@ private readonly GridData data = new(); private IgbGridLite grid = null!; private EventCallback filtered; - private int refreshCount; - private int sortedCount; private string lastFiltering = "none"; private int filteredCount; @@ -43,16 +38,6 @@ private void OnFiltered(IgbGridLiteFilteredEventArgs args) => filteredCount++; - private async Task RefreshAsync() - { -#pragma warning disable CS0618 // Deprecated but still shipped: a re-render must not duplicate the grid's event listeners. - await grid.RefreshAsync(); -#pragma warning restore CS0618 - refreshCount++; - } - - private void OnSorted(IgbGridLiteSortedEventArgs args) => sortedCount++; - private void OnFiltering(IgbGridLiteFilteringEventArgs args) => lastFiltering = $"{args.Type} {string.Join(", ", args.Expressions.Select(e => e.Condition))}"; } diff --git a/tests/IgniteUI.Blazor.GridLite.Tests/EnumSerializationTests.cs b/tests/IgniteUI.Blazor.GridLite.Tests/EnumSerializationTests.cs index f473234..afb2d2c 100644 --- a/tests/IgniteUI.Blazor.GridLite.Tests/EnumSerializationTests.cs +++ b/tests/IgniteUI.Blazor.GridLite.Tests/EnumSerializationTests.cs @@ -26,9 +26,6 @@ public void SortingDirection_SerializesToCamelCase(GridLiteSortingDirection valu [InlineData(GridLiteColumnDataType.String, "string")] [InlineData(GridLiteColumnDataType.Number, "number")] [InlineData(GridLiteColumnDataType.Boolean, "boolean")] -#pragma warning disable CS0618 // Deprecated but still shipped: its wire value has to hold until it is removed. - [InlineData(GridLiteColumnDataType.Date, "date")] -#pragma warning restore CS0618 public void ColumnDataType_SerializesToCamelCase(GridLiteColumnDataType value, string expected) { Assert.Equal($"\"{expected}\"", JsonSerializer.Serialize(value)); diff --git a/tests/IgniteUI.Blazor.GridLite.Tests/GridLiteJsInteropTests.cs b/tests/IgniteUI.Blazor.GridLite.Tests/GridLiteJsInteropTests.cs index b063b9a..35825be 100644 --- a/tests/IgniteUI.Blazor.GridLite.Tests/GridLiteJsInteropTests.cs +++ b/tests/IgniteUI.Blazor.GridLite.Tests/GridLiteJsInteropTests.cs @@ -93,47 +93,6 @@ public void InitialRender_FiresRenderedCallback() cut.WaitForAssertion(() => Assert.Equal(1, renderedCount)); } -#pragma warning disable CS0618 // Deprecated but still shipped, so its behavior has to hold until it is removed. - // Without it, a re-render would signal readiness again to handlers that expect it once. - [Fact] - public async Task RefreshAsync_DoesNotFireRenderedAgain() - { - var renderedCount = 0; - var cut = RenderGrid(ps => ps.Add(x => x.Rendered, () => renderedCount++)); - cut.WaitForAssertion(() => Assert.Equal(1, renderedCount)); - - await cut.InvokeAsync(() => cut.Instance.RefreshAsync()); - - GridApi.VerifyInvoke($"{Api}.renderGrid", calledTimes: 2); - Assert.Equal(1, renderedCount); - } - - [Fact] - public async Task RefreshAsync_InvokesRenderGridAgain() - { - var cut = RenderGrid(); - - await cut.InvokeAsync(() => cut.Instance.RefreshAsync()); - - GridApi.VerifyInvoke($"{Api}.renderGrid", calledTimes: 2); - } - - [Fact] - public async Task UpdateDataAsync_InvokesUpdateData_WithSerializedData() - { - var cut = RenderGrid(); - var newData = new List { new() { Id = 42, Name = "Ipoh Coffee", Price = 46.0 } }; - - await cut.InvokeAsync(() => cut.Instance.UpdateDataAsync(newData)); - - var invocation = GridApi.VerifyInvoke($"{Api}.updateData"); - Assert.Equal(cut.Find("igc-grid-lite").GetAttribute("id"), invocation.Arguments[0]); - var data = ParseJsonArgument(invocation.Arguments[1]); - Assert.Equal(1, data.GetArrayLength()); - Assert.Same(newData, cut.Instance.Data); - } -#pragma warning restore CS0618 - // bUnit cannot hold back a call that returns an IJSObjectReference, so this swaps in a runtime whose import waits. private sealed class HeldScriptLoad { @@ -201,18 +160,20 @@ public async Task DisposingWhileScriptLoads_DoesNotRenderAfterwards() // Without the check, a render that resumes after disposal registers the grid on the client again // after destroyGrid removed it. [Fact] - public async Task RenderAfterDisposal_DoesNotInvokeRenderGrid() + public async Task DisposingWhileRenderYields_DoesNotRenderAfterwards() { - var cut = RenderGrid(); - var grid = cut.Instance; - await DisposeComponentsAsync(); + var load = new HeldScriptLoad(Services); + var cut = Render>(ps => ps.Add(x => x.Data, Items)); -#pragma warning disable CS0618 // Deprecated but still shipped. - await cut.InvokeAsync(() => grid.RefreshAsync()); -#pragma warning restore CS0618 + // Completing the load runs the first render inline up to its yield, so the disposal lands in that yield. + await cut.InvokeAsync(async () => + { + load.Complete(); + await DisposeComponentsAsync(); + }); - GridApi.VerifyInvoke($"{Api}.destroyGrid"); - GridApi.VerifyInvoke($"{Api}.renderGrid", calledTimes: 1); + cut.WaitForAssertion(() => load.GridApi.Verify(x => x.DisposeAsync(), Times.Once)); + Assert.Equal([$"{Api}.destroyGrid", nameof(IJSObjectReference.DisposeAsync)], load.GridApiCalls); } // Without it, a failed destroyGrid leaves the .NET reference registered with the client, which keeps the grid alive. @@ -409,15 +370,11 @@ public async Task PublicMethods_RejectNullArguments_WithoutCallingJs() var cut = RenderGrid(); // Deliberate nulls: the guards exist for callers with nullable analysis off. -#pragma warning disable CS0618 // Deprecated but still shipped. - await Assert.ThrowsAsync(() => cut.InvokeAsync(() => cut.Instance.UpdateDataAsync(null!))); -#pragma warning restore CS0618 await Assert.ThrowsAsync(() => cut.InvokeAsync(() => cut.Instance.SortAsync((IgbGridLiteSortingExpression)null!))); await Assert.ThrowsAsync(() => cut.InvokeAsync(() => cut.Instance.SortAsync((IEnumerable)null!))); await Assert.ThrowsAsync(() => cut.InvokeAsync(() => cut.Instance.FilterAsync((IgbGridLiteFilterExpression)null!))); await Assert.ThrowsAsync(() => cut.InvokeAsync(() => cut.Instance.FilterAsync((IEnumerable)null!))); - GridApi.VerifyNotInvoke($"{Api}.updateData"); GridApi.VerifyNotInvoke($"{Api}.sort"); GridApi.VerifyNotInvoke($"{Api}.filter"); }