How can I make Blazor app to support PWA?
A Progressive Web Application is a Single Page Application that uses modern browser APIs, and performs like a desktop app. It can work offline and load instantly, and independent of network speed. Find the steps for create PWA with blazor app: Create a project from the PWA template Run the application, after creating the app After it launched in the browser, there we have the option for installing the app (PWA) Once installed, the app appears in its own window without an address bar. Please refer to the documentation link for more details: https://docs.microsoft.com/en-us/aspnet/core/blazor/progressive-web-app?view=aspnetcore-3.1&tabs=visual-studio#create-a-project-from-the-pwa-template
How do I refresh the Blazor component without reloading the page when database is updated?
You can refresh the Blazor component using the SignalR concept without reloading the page. When using SignalR, saving the changes in one page notifies the changes made to other clients. During the notification process, call the data loading method to reload the changes made to that component without reloading the entire page. Please refer to the documentation link for more details: https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr-blazor-webassembly?view=aspnetcore-3.1&tabs=visual-studio
How do I suppress the UI rendering in Blazor?
Override the ShouldRender method to suppress UI rendering. If the implementation returns true, the UI is refreshed. Initial rendering cannot be prevented using this method. [Counter.razor]
How can I properly dispose a component in Blazor?
Components should be disposed properly to avoid memory leak and allow proper garbage collection. Managed resources used by the application will be disposed by the Blazor framework itself. If a component implements IDisposable, the Dispose method will be called when the component is removed from the UI. You can use Dispose method to release unmanaged resources, unhook events, dispose DotNetObjectReference instances to avoid memory leak. Refer to the following code sample. More information about component disposal can be found here.
How do you preserve whitespaces in a Blazor application?
From .NET 5 Preview 7, Blazor components trim insignificant whitespaces to achieve better performance. This has been implemented as a result of the finding that 40% of the rendering time is consumed by whitespace nodes. If whitespace nodes removal causes unexpected behavior, you can simply enable it by using the @preservewhitespace directive. View Sample in GitHub