Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blazor] Behavioral breaking change in .NET 8.0 component re-rendering #58417

Open
1 task done
S-Luiten opened this issue Oct 14, 2024 · 0 comments
Open
1 task done
Assignees
Labels
area-blazor Includes: Blazor, Razor Components investigate

Comments

@S-Luiten
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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:
Image
After:
Image

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:
Image

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):
Image

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Oct 14, 2024
@mkArtakMSFT mkArtakMSFT added this to the .NET 10 Planning milestone Oct 14, 2024
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 investigate
Projects
None yet
Development

No branches or pull requests

3 participants