microsoft / fluentui-blazor

Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications
https://www.fluentui-blazor.net
MIT License
3.78k stars 363 forks source link

fix: NavMenu not found in Fluent Blazor Web App Template #992

Closed pk9r closed 11 months ago

pk9r commented 11 months ago

🐛 Bug Report

💁 Possible Solution

When Interactive Render Mode is Auto, NavMenu with @rendermode InteractiveAuto but not in Client project. This will cause an error when the render mode changes to client-side. https://github.com/microsoft/fluentui-blazor/blob/538fd96a14d5ba3cdbd80225fa9113300306dba3/src/Templates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Layout/NavMenu.razor#L4C26-L4C26

The Auto render mode determines how to render the component at runtime. The component is initially rendered server-side with interactivity using the Blazor Server hosting model. The .NET runtime and app bundle are downloaded to the client in the background and cached so that they can be used on future visits. Components using the automatic render mode must be built from a separate client project that sets up the Blazor WebAssembly host.

See more at: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0#auto-render-mode

🌍 Your Environment

pk9r commented 11 months ago

I just found #938, I think we need to do something about this at least change InteractiveAuto to InteractiveServer. It's not nice when a template throws an error because of a default option.

vnbaaij commented 11 months ago
I'm changing this for the next version of the templates (4.0.1). It will behave like this: Rendermode / Interactivity NavMenu @rendermode NavMenu Collapsible WC script in body
SSR / not applicable
Server / Global
Server / Per Page
WebAssembly / Global*
WebAssembly / Per Page*
Auto / Global*
Auto / Per Page*

*NavMenu moved to Client project