-
🐛 Bug ReportI'm new to Blazor and created a new .NET 9 Blazor web app with per page render mode and want to use the ToastService. But as the MainLayout.razor file is shared between Server-side rendered page and client-side rendered pages i don't know what rendermode to set for the Options are:
I also tried to dynamically set rendermode based on .NET9 RendererInfo.Name or AssignedRenderMode but no Luck. The only workaround i found to include the FluentToastProvider separately on each page which leads to other problems as it might get added twice (in components), fake scrollbars and all toast are removed an page navigation (so RemoveToastsOnNavigation has no effect) . And of course its easy to forget to include. I've the same problem with the other providers which require interactivity So whats the correct approach here? 💻 Repro or Code SampleMy MainLayout.razor:
The either use with this RenderAt class:
🤔 Expected BehaviorProviders should work with per-page rendering 😯 Current BehaviorNo way to include Provider into MainLayout.razor with per-page rendering 💁 Possible Solution🔦 Context🌍 Your Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
Hi,
Moved it here because it is not an issue with the library but a usage question. I would even go as far as saying it is more a general Blazor question.
It is not enough to just add interactivity to the
FluentToastProvider
. The page you are displaying needs to have interactivity as well. So you need to add @rendermode to the pages you want toast on as well (that is why it is called 'per page')So, in
MainLayout.razor
:In
Home.razor
(in the server project, when using the Web App template))