You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating a blazor server project from .NET 7.0 to .NET 8.0, I noticed that components no longer re-render when needed.
The issue appears to be related to having global state passed through a cascading parameter, where the component/page containing the cascading value component is not involved with a state change, and StateHasChanged is not invoked directly on the component that needs to be re-rendered.
The project has .NET 7.0 and .NET 8.0 target frameworks. The issue can only be reproduced when the target framework is .NET 8.0. Additionally, there is a second page (Home2.razor, /2) where this issue is not present on both .NET 7.0 and .NET 8.0 (so this page shows the expected behavior). The only different between Home.razor and Home2.razor is that Home2.razor handles both the event callback / statehaschanged and the cascading value, whereas Home.razor only has the cascading value, and leaves the rest to a child component.
On .NET 7.0, after clicking the 'Refresh page' button, an async task is simulated, and one second later the page shows the new data:
Before:
After:
On .NET 8.0, only the listener child component is updated, the invoker child component and the listener's sub-child components do not update:
Note that on Home2.razor, the page rerenders immediately after clicking the button (which is why the value is incremented after the simulated task, so you can see the second time it rerenders):
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Describe the bug
After updating a blazor server project from .NET 7.0 to .NET 8.0, I noticed that components no longer re-render when needed.
The issue appears to be related to having global state passed through a cascading parameter, where the component/page containing the cascading value component is not involved with a state change, and
StateHasChanged
is not invoked directly on the component that needs to be re-rendered.Expected Behavior
No response
Steps To Reproduce
https://github.com/S-Luiten/TestBlazorRerenderIssue
The project has .NET 7.0 and .NET 8.0 target frameworks. The issue can only be reproduced when the target framework is .NET 8.0. Additionally, there is a second page (Home2.razor,
/2
) where this issue is not present on both .NET 7.0 and .NET 8.0 (so this page shows the expected behavior). The only different between Home.razor and Home2.razor is that Home2.razor handles both the event callback / statehaschanged and the cascading value, whereas Home.razor only has the cascading value, and leaves the rest to a child component.On .NET 7.0, after clicking the 'Refresh page' button, an async task is simulated, and one second later the page shows the new data:
Before:
After:
On .NET 8.0, only the listener child component is updated, the invoker child component and the listener's sub-child components do not update:
Note that on Home2.razor, the page rerenders immediately after clicking the button (which is why the value is incremented after the simulated task, so you can see the second time it rerenders):
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: