Repository navigation
[Blazor] Fix cascading parameter hot reload caching - #68885
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
javiercn
force-pushed
the
javiercn-fix-hot-reload-cascading-cache
branch
from
August 28, 2026 17:07
68d79e2 to
02c4d91
Compare
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
maraf
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[PersistentState]values when subscriptions are rebuiltICascadingValueSuppliersupport-hot-reloadskill and general abstraction guidanceFixes #67624
Validation
dotnet test src\Components\Components\test\Microsoft.AspNetCore.Components.Tests.csproj --no-restore --filter "FullyQualifiedName~CascadingParameterTest.HotReload|FullyQualifiedName~PersistentStateValueProviderTests|FullyQualifiedName~PersistentValueProviderComponentSubscriptionTests" -v:qdotnet watchwith Playwright: the delta applied without restarting, a retained component received its newly added[CascadingParameter], and a new prerender/interactive circuit restored newly added[PersistentState]