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 AddInteractiveServerComponents conflicts with Identity pages #61320

Closed
1 task done
asadsahi opened this issue Apr 4, 2025 · 1 comment
Closed
1 task done
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@asadsahi
Copy link

asadsahi commented Apr 4, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Created a blank Blazor starter app with Individual authentication. It works mostly. However in order to add interactivity e.g onclick events, enable InteractiveServer on Routes component as per documentation:

<Routes @rendermode="RenderMode.InteractiveServer"/>

With this button click events started working. However this breaks authentication pages and started displaying blank "Not found" page.

Tried different combination of rendering modes, but none works with client side interactivity and identity pages.

Expected Behavior

InteractiveServer mode should work both for blazor components and Identity pages.

Steps To Reproduce

Here is sample repo with the issue:

https://github.com/fs-pro/BlazorApp1

Exceptions (if any)

No response

.NET Version

9.0

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Apr 4, 2025
@asadsahi
Copy link
Author

asadsahi commented Apr 5, 2025

One possible solution I've found is dynamically changing the render mode for Identity page in App.razor component:

........
........

<body>
    <Routes @rendermode="RenderModeForPage" />
</body>

</html>

@code {
    [CascadingParameter]
    private HttpContext HttpContext { get; set; } = default!;

    private IComponentRenderMode? RenderModeForPage =>
        HttpContext.Request.Path.StartsWithSegments("/Account")
            ? null
            : InteractiveServer;
}

@asadsahi asadsahi closed this as completed Apr 5, 2025
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
Projects
None yet
Development

No branches or pull requests

1 participant