Skip to content

Fix QuickGridNoInteractivityTest#66977

Merged
dariatiurina merged 7 commits into
dotnet:mainfrom
dariatiurina:66883-fix-quickgrid-tests
Jun 30, 2026
Merged

Fix QuickGridNoInteractivityTest#66977
dariatiurina merged 7 commits into
dotnet:mainfrom
dariatiurina:66883-fix-quickgrid-tests

Conversation

@dariatiurina

@dariatiurina dariatiurina commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Fix QuickGridNoInteractivityTest

Summary

Un-quarantines QuickGridNoInteractivityTest by forcing the QuickGrid URL-based navigation feature switch to be observed in the test server, even when QuickGridFeatureFlags's static cache was already initialized by an earlier test scenario.

Changes

  • RazorComponentEndpointsNoInteractivityStartup.ConfigureServices: after calling AppContext.SetSwitch("Microsoft.AspNetCore.Components.QuickGrid.EnableUrlBasedQuickGridNavigationAndSorting", true), additionally uses reflection to set the private static field QuickGridFeatureFlags.s_enableUrlBasedQuickGridNavigationAndSorting to true. This guarantees the flag is on regardless of whether the type was already initialized in the test host process.
  • QuickGridNoInteractivityTest: removes the [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/66883")] attribute now that the test can reliably observe the enabled feature switch.

Details

QuickGridFeatureFlags.EnableUrlBasedQuickGridNavigationAndSorting reads the AppContext switch into a static field on first access. When another test scenario in the same process touches the type before AppContext.SetSwitch runs (or before this startup runs), the cached value sticks and SetSwitch has no effect. The reflection-based write to s_enableUrlBasedQuickGridNavigationAndSorting overrides that cached value so this startup's intent is honored.

Testing

  • QuickGridNoInteractivityTest is un-quarantined; it should now pass reliably in CI runs that share the test host with other QuickGrid scenarios.

Fixes #66883

@dariatiurina dariatiurina self-assigned this Jun 4, 2026
@dariatiurina dariatiurina marked this pull request as ready for review June 4, 2026 15:06
Copilot AI review requested due to automatic review settings June 4, 2026 15:06
@dariatiurina dariatiurina requested a review from a team as a code owner June 4, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes process-wide (order-dependent) QuickGrid feature-flag mutation from the Components test server by introducing a per-component-tree opt-in/opt-out for URL-based navigation/sorting via a named cascading parameter. This should eliminate the global-state interaction that made QuickGridNoInteractivityTest flaky and allows URL-driven and legacy button-driven scenarios to run in the same server process.

Changes:

  • Added an internal, named cascading override (EnableUrlBasedQuickGridNavigationAndSorting) to QuickGrid<TGridItem> and Paginator, with fallback to the existing AppContext switch.
  • Updated QuickGrid UI rendering (column headers + paginator UI) to respect the per-tree override via UseUrlBasedNavigationAndSorting.
  • Removed AppContext.SetSwitch(...) + reflection cache-busting from test server startup, updated test pages to provide the cascading override locally, and un-quarantined QuickGridNoInteractivityTest.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/QuickGrid/QuickGridInteractive.razor Drives URL-based vs legacy UI via config-backed cascading override for interactive E2E scenarios.
src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/QuickGrid/QuickGridComponent.razor Forces URL-based behavior for the no-interactivity QuickGrid page via cascading override.
src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs Removes global AppContext switch mutation and reflection-based cache override.
src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsNoInteractivityStartup.cs Removes global AppContext switch mutation for the no-interactivity startup.
src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor Forces legacy/button-based UI locally via cascading override to keep compat behavior stable.
src/Components/test/E2ETest/Tests/QuickGridNoInteractivityTest.cs Un-quarantines the test now that global state coupling is removed.
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGridFeatureFlags.cs Promotes the switch-name constant to internal for reuse in named cascading parameters.
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs Adds named cascading override + UseUrlBasedNavigationAndSorting helper for descendant rendering decisions.
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor.cs Adds named cascading override + UseUrlBasedNavigationAndSorting helper for paginator rendering.
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor Switches between anchor vs button paginator UI based on the new per-tree override.
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor Switches sortable column header rendering (anchor vs button) to respect Grid.UseUrlBasedNavigationAndSorting.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@dariatiurina dariatiurina enabled auto-merge (squash) June 30, 2026 13:58
@dariatiurina dariatiurina merged commit 92b8fe3 into dotnet:main Jun 30, 2026
25 checks passed
javiercn pushed a commit that referenced this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

4 participants