dotnet / dotnet/aspnetcore

[Validation] QuickGrid query parameter names

Closed
#69,129 2 comments 0 reactions 1 assignee Claimed by @BrundhaVelusamy View on GitHub
area-blazor Validation validation-scenario
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

**Scenario contact:** @dariatiurina

## Scenario

Because sort and page state now live in the query string, every `QuickGrid` on a page competes for the same parameter names, and so does any parameter the page already uses for its own purposes. `QueryParameterNameOptions` lets each grid be given its own names.

Validate what two grids do when both use the default names, that giving each its own names keeps them independent, and that a grid can be moved off a name the page already owns.

## Minimum build

.NET 11 RC1.

## Configurations to cover

* Blazor Web App
* [x] Static SSR
* [x] Interactive Server
* [ ] Interactive WebAssembly
* [ ] Interactive Auto
* [ ] Standalone WebAssembly
* [ ] Hybrid (MAUI)

## Also exercise

* [ ] Published output
* [ ] An existing .NET 10 app upgraded to .NET 11
* [ ] Trimming or ahead-of-time compilation
* [ ] More than one server instance, or a proxy in front
* [ ] Hot Reload
* [ ] An IDE as well as the command line
* [ ] Container
* [x] N/A

## What to build

A page with two `QuickGrid` instances over different in-memory lists, each with its own `Paginator` and enough pages to observe paging. Give both grids a sortable column with the same title so shared default sort parameters cannot appear independent merely because one grid does not recognize the other's column name. Show distinct item identities for each list. Start with the default parameter names.

Then give each grid its own parameter names.

Add a second page that already uses `page` and `sort` query parameters for its own purposes, such as a filter and a wizard step. Display those values on the page alongside one grid initially using the default names.

## Things to try

* With both grids on the default names, sort one and watch the other; then page one and watch the other.
* Give each grid its own names and repeat.
* Sort and page both grids, then copy the URL and open it in a private window.
* On the page that owns `page` and `sort`, sort the grid and check the page's own values.
* Move that grid onto its own names and repeat.
* Give two grids the same custom names on purpose.
* Use the prefix accepted by `QueryParameterNameOptions` rather than naming each parameter individually, and record the resulting names. Include any desired separator in the prefix itself rather than assuming the grid inserts one.
* Give one parameter a name containing a space or another character requiring URL encoding, and check the value round-trips.

## Expected behavior

Grids with distinct parameter names keep independent sort and page state, and leave any parameter the page owns alone. One URL reproduces the whole page.

### Must hold

* With distinct parameter names, sorting or paging one grid changes only that grid's parameters and leaves the other grid's rows unchanged.
* A single URL carrying both grids' parameters reproduces both grids' sort and page in a fresh browser session.
* On the page that owns `page` and `sort`, after the grid is moved onto its own names, sorting and paging the grid leaves the page's own `page` and `sort` values unchanged.
* Using a prefix produces parameters named with that prefix, and the grid reads back the values it wrote.
* A parameter name that needs URL escaping still round-trips: the grid reads back the value it wrote.

### Expected differences between configurations

* Static SSR requests server-rendered content and may use enhanced navigation; Interactive Server rerenders its grid. Parameter naming and state independence should be the same.

## Evidence to capture

* The full query string after interacting with each grid, before and after giving them distinct names.
* What both grids did when they shared the default names, and again when given identical custom names.
* The page's own `page` and `sort` values before and after sorting the grid on the collision page.

## Documentation to use

* [ASP.NET Core Blazor QuickGrid component](https://learn.microsoft.com/aspnet/core/blazor/components/quickgrid?view=aspnetcore-11.0)

Report how easily you found the per-grid parameter naming from the docs. A developer only looks for it after two grids have already interfered with each other, so it needs to be findable from that symptom.

## What to report

Report results using the format described in the [validation testing manual](https://github.com/dotnet/aspnetcore/issues/68479). Include link to a repository with the test app.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.