Skip to content

No default interactivity without @rendermode specified in .NET 8 Preview 7 #49987

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

Closed
1 task done
bub-bl opened this issue Aug 10, 2023 · 2 comments
Closed
1 task done
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved

Comments

@bub-bl
Copy link

bub-bl commented Aug 10, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When we add the Counter component in a page without @rendermode specified, the component is rendered without interactivity.

(The Counter component does not have a render target specified in the Counter.razor file).

Expected Behavior

The component should have a default server interactivity ?

Steps To Reproduce

@*This component does not have any interactivity*@
<Net8BlazorAuto.Client.Pages.Counter/>

@*Those components have interactivity*@
<Net8BlazorAuto.Client.Pages.Counter @rendermode="@RenderMode.Server"/>
<Net8BlazorAuto.Client.Pages.Counter @rendermode="@RenderMode.WebAssembly"/>
<Net8BlazorAuto.Client.Pages.Counter @rendermode="@RenderMode.Auto"/>
  • Run the project.

Additionnaly

If you create a page on the client side, the page is not reachable from the browser with the error bellow.

  • Create a page on the client side named Test
  • Add the follwing code
@page "/test"

<h3>Test</h3>

@code {
    
}
  • Run the project
  • Navigate to /test

image

Exceptions (if any)

No response

.NET Version

8.0.100-preview.7.23376.3

Anything else?

C:\Users\bubbl>dotnet --version
8.0.100-preview.7.23376.3

C:\Users\bubbl>dotnet --info
SDK .NET :
Version: 8.0.100-preview.7.23376.3
Commit: daebeea8ea

Environnement d'exécution :
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\

.NET workloads installed:
Il n'y a aucune charge de travail installée à afficher.

Host:
Version: 8.0.0-preview.7.23375.6
Architecture: x64
Commit: 65b696cf5e
RID: win-x64

.NET SDKs installed:
7.0.306 [C:\Program Files\dotnet\sdk]
8.0.100-preview.7.23376.3 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0-preview.7.23376.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Aug 10, 2023
@mkArtakMSFT
Copy link
Member

Thanks for contacting us.
This behavior is by-design. The rendermode value for a given component, if not specified explicitly, is inherited from its parent component. And when not specified on any of the parent elements, it defaults to static rendering mode, which enables no interactivity.
Also, @RenderMode.Server enables server interactivity (through a web-socket connection) rather than a static (state-less) rendering.

@mkArtakMSFT mkArtakMSFT added the ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. label Aug 10, 2023
@ghost ghost added the Status: Resolved label Aug 10, 2023
@balenamiaa
Copy link

balenamiaa commented Aug 10, 2023

Thanks for contacting us. This behavior is by-design. The rendermode value for a given component, if not specified explicitly, is inherited from its parent component. And when not specified on any of the parent elements, it defaults to static rendering mode, which enables no interactivity. Also, @RenderMode.Server enables server interactivity (through a web-socket connection) rather than a static (state-less) rendering.

#49314 Wasn't it discussed in this issue that the default rendering mode should have server interactivity?

@ghost ghost locked as resolved and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants