Skip to content

[Blazor] Fix cascading parameter hot reload caching - #68885

Merged
javiercn merged 4 commits into
mainfrom
javiercn-fix-hot-reload-cascading-cache
Sep 1, 2026
Merged

javiercn merged 4 commits into
mainfrom
javiercn-fix-hot-reload-cascading-cache

Conversation

@javiercn

@javiercn javiercn commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • clear cached cascading-parameter metadata when Hot Reload applies a delta
  • refresh cascading parameter matches and subscriptions for retained component instances
  • preserve current [PersistentState] values when subscriptions are rebuilt
  • keep supplier-specific refresh behavior behind ICascadingValueSupplier
  • add focused regression coverage for fixed, subscribed, single-delivery, and persistent-state suppliers
  • add the repo-owned support-hot-reload skill and general abstraction guidance

Fixes #67624

Validation

  • dotnet test src\Components\Components\test\Microsoft.AspNetCore.Components.Tests.csproj --no-restore --filter "FullyQualifiedName~CascadingParameterTest.HotReload|FullyQualifiedName~PersistentStateValueProviderTests|FullyQualifiedName~PersistentValueProviderComponentSubscriptionTests" -v:q
  • manually validated under dotnet watch with Playwright: the delta applied without restarting, a retained component received its newly added [CascadingParameter], and a new prerender/interactive circuit restored newly added [PersistentState]

Copilot AI lite review requested due to automatic review settings August 28, 2026 09:56
@javiercn
javiercn requested a review from a team as a code owner August 28, 2026 09:56

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 improves Blazor Hot Reload behavior for cascading parameters by ensuring cascading-parameter metadata caches are invalidated on metadata deltas and by refreshing cascading parameter matches/subscriptions for retained component instances without re-delivering single-delivery values. It also preserves current [PersistentState] component property values when persistent-state subscriptions are rebuilt during hot reload, and adds regression tests to cover these scenarios.

Changes:

  • Clear cached cascading-parameter reflection metadata on Hot Reload deltas (and before hot-reload re-render passes).
  • Refresh cascading-parameter matches and rebuild subscriptions for retained components during metadata-update rendering, with a new subscription “mode” to let suppliers adapt (e.g., preserve current persistent-state values).
  • Add focused regression tests for hot reload cascading-parameter refresh, subscription rebuilds, single-delivery behavior, and persistent-state preservation.

Reviewed changes

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

Show a summary per file
File Description
src/Components/Components/test/CascadingParameterTest.cs Adds Hot Reload regression coverage for cascading parameter refresh, subscription rebuilds, single-delivery behavior, and persistent-state preservation.
src/Components/Components/src/RenderTree/Renderer.cs Clears cascading-parameter cache before hot-reload root re-render pass.
src/Components/Components/src/Rendering/ComponentState.cs Refreshes cascading parameter matches/subscriptions during metadata-update parameter supply; tracks initial parameter supply to respect single-delivery semantics.
src/Components/Components/src/PersistentState/PersistentValueProviderComponentSubscription.cs Adds a helper to preserve the component’s current persistent-state property value when rebuilding subscriptions.
src/Components/Components/src/PersistentState/PersistentStateValueProvider.cs Implements subscription behavior that preserves current values when subscriptions are rebuilt on metadata refresh.
src/Components/Components/src/ICascadingValueSupplier.cs Introduces a subscription mode to distinguish initial subscriptions vs metadata-refresh rebuilds (defaulting to existing behavior).
src/Components/Components/src/CascadingParameterState.cs Adds hot-reload cache invalidation (ClearCache + metadata delta hook) for cascading-parameter reflection metadata.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@javiercn
javiercn requested review from a team and wtgodbe as code owners August 28, 2026 10:32
@javiercn
javiercn force-pushed the javiercn-fix-hot-reload-cascading-cache branch from 68d79e2 to 02c4d91 Compare August 28, 2026 17:07
javiercn added a commit that referenced this pull request Sep 1, 2026
* Improve agent guidance for cross-runtime Components work

* Keep Components guidance implementation-neutral

* Collect reusable Components guidance

Import the general abstraction-boundary rule from #68885 without its unrelated Hot Reload skill and product changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: df7627de-b860-4c91-ba05-338c677a8c52

* Update Bootstrap to 5.3.8 in templates and Identity UI

Refresh all vendored Bootstrap 5 assets, CDN integrity hashes, licenses, and package-test expectations. Extend the copy automation to cover the current Blazor template path, standalone WebAssembly, and Identity UI.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 95292c6a-5353-44bc-9065-d2fe86d53e90

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: df7627de-b860-4c91-ba05-338c677a8c52
Copilot-Session: 95292c6a-5353-44bc-9065-d2fe86d53e90
javiercn added a commit that referenced this pull request Sep 1, 2026
* Improve agent guidance for cross-runtime Components work

* Keep Components guidance implementation-neutral

* Collect reusable Components guidance

Import the general abstraction-boundary rule from #68885 without its unrelated Hot Reload skill and product changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: df7627de-b860-4c91-ba05-338c677a8c52

* Update Bootstrap to 5.3.8 in templates and Identity UI

Refresh all vendored Bootstrap 5 assets, CDN integrity hashes, licenses, and package-test expectations. Extend the copy automation to cover the current Blazor template path, standalone WebAssembly, and Identity UI.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 95292c6a-5353-44bc-9065-d2fe86d53e90

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: df7627de-b860-4c91-ba05-338c677a8c52
Copilot-Session: 95292c6a-5353-44bc-9065-d2fe86d53e90
@javiercn
javiercn merged commit 9988228 into main Sep 1, 2026
32 checks passed
@javiercn
javiercn deleted the javiercn-fix-hot-reload-cascading-cache branch September 1, 2026 13:01
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hot Reload: CascadingParameterState static cache is never cleared, so new [CascadingParameter] additions require a restart

3 participants