Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
37 changes: 0 additions & 37 deletions src/IgniteUI.Blazor.GridLite/IgbGridLite.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> clientRender = new(TaskCreationOptions.RunContinuationsAsynchronously);

/// <summary>
/// The unique identifier for this grid instance
/// </summary>
[Obsolete("The grid's internal id is not needed to use it. It will be removed in a future release.")]
public string GridId => gridId;

/// <inheritdoc/>
protected override async Task OnAfterRenderAsync(bool firstRender)
{
Expand Down Expand Up @@ -208,15 +202,6 @@ public override async Task SetParametersAsync(ParameterView parameters)
}
}

/// <summary>
/// Re-renders the grid on the client with the current data and configuration.
/// </summary>
[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)
Expand Down Expand Up @@ -268,28 +253,6 @@ private static GridLiteDataPayload CreateDataPayload(IEnumerable<TItem>? data)
return new GridLiteDataPayload(data ?? Array.Empty<TItem>(), AppValueSerializer.GetDataTypeInfo<TItem>());
}

/// <summary>
/// Refreshes the grid by re-rendering it with the current data and configuration.
/// </summary>
[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();
}

/// <summary>
/// Updates the data source for the grid.
/// </summary>
/// <param name="newData">The new data to display in the grid</param>
[Obsolete("Assign a new collection to the Data parameter instead. It will be removed in a future release.")]
public async Task UpdateDataAsync(IEnumerable<TItem> newData)
{
ArgumentNullException.ThrowIfNull(newData);
Data = newData;
var json = JsonSerializer.Serialize(newData, AppValueSerializer.GetDataTypeInfo<TItem>());
await InvokeVoidJsAsync("blazor_igc_grid_lite.updateData", gridId, json);
}

/// <summary>
/// Performs a sort operation in the grid based on the passed expression(s).
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,4 @@ public enum GridLiteColumnDataType

/// <summary><see langword="true"/>/<see langword="false"/> values.</summary>
Boolean,

/// <summary>
/// The grid-lite web component has no date data type; this value behaves like <see cref="String"/>.
/// It will be removed in a future release.
/// </summary>
[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
}
7 changes: 0 additions & 7 deletions src/IgniteUI.Blazor.GridLite/igc-grid-lite-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
21 changes: 0 additions & 21 deletions tests/IgniteUI.Blazor.GridLite.IntegrationTests/GridLiteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<h1>GridLite TestBed</h1>

<IgbGridLite @ref="grid" TItem="NwindDataItem" Data="data" Sorted="OnSorted" Filtering="OnFiltering" Filtered="filtered" data-testid="test-grid">
<IgbGridLite @ref="grid" TItem="NwindDataItem" Data="data" Filtering="OnFiltering" Filtered="filtered" data-testid="test-grid">
<IgbGridLiteColumn Field="@nameof(NwindDataItem.ProductID)"
Header="ID"
DataType="GridLiteColumnDataType.Number" />
Expand All @@ -19,9 +19,6 @@
DataType="GridLiteColumnDataType.Number" />
</IgbGridLite>

<button id="refresh-button" @onclick="RefreshAsync">Refresh</button>
<p id="refresh-count">@refreshCount</p>
<p id="sorted-count">@sortedCount</p>
<p id="last-filtering">@lastFiltering</p>

<button id="navigate-button" @onclick="@(() => grid.NavigateToAsync(3, activate: true))">Navigate</button>
Expand All @@ -34,25 +31,13 @@
private readonly GridData data = new();
private IgbGridLite<NwindDataItem> grid = null!;
private EventCallback<IgbGridLiteFilteredEventArgs> filtered;
private int refreshCount;
private int sortedCount;
private string lastFiltering = "none";
private int filteredCount;

private void BindFiltered() => filtered = EventCallback.Factory.Create<IgbGridLiteFilteredEventArgs>(this, OnFiltered);

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))}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
65 changes: 11 additions & 54 deletions tests/IgniteUI.Blazor.GridLite.Tests/GridLiteJsInteropTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TestItem> { 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
{
Expand Down Expand Up @@ -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<IgbGridLite<TestItem>>(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.
Expand Down Expand Up @@ -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<ArgumentNullException>(() => cut.InvokeAsync(() => cut.Instance.UpdateDataAsync(null!)));
#pragma warning restore CS0618
await Assert.ThrowsAsync<ArgumentNullException>(() => cut.InvokeAsync(() => cut.Instance.SortAsync((IgbGridLiteSortingExpression)null!)));
await Assert.ThrowsAsync<ArgumentNullException>(() => cut.InvokeAsync(() => cut.Instance.SortAsync((IEnumerable<IgbGridLiteSortingExpression>)null!)));
await Assert.ThrowsAsync<ArgumentNullException>(() => cut.InvokeAsync(() => cut.Instance.FilterAsync((IgbGridLiteFilterExpression)null!)));
await Assert.ThrowsAsync<ArgumentNullException>(() => cut.InvokeAsync(() => cut.Instance.FilterAsync((IEnumerable<IgbGridLiteFilterExpression>)null!)));

GridApi.VerifyNotInvoke($"{Api}.updateData");
GridApi.VerifyNotInvoke($"{Api}.sort");
GridApi.VerifyNotInvoke($"{Api}.filter");
}
Expand Down
Loading