To Prerender or Not To Prerender 🔥 .NET 8 & Blazor Server/WebAssembly/Auto Render Mode

preview_player
Показать описание
➡️ Use code START2024 for 10% off!

Table of Contents:
00:00 To Prerender or Not To Prerender 🔥 .NET 8 & Blazor
01:08 Create the Project
02:42 Blazor Server Render Mode
06:03 Disable Prerendering
08:40 Blazor WebAssembly Render Mode
10:09 Blazor Auto Render Mode

#DotNet #Blazor #AspNetCore
Рекомендации по теме
Комментарии
Автор

MS did not handle this feature well. The syntax is a mess, changed right before release, and they seem to have not bothered to prepare people for it with sufficient docs and examples. When the actual template sample page (Weather) displays the problematic behavior and doesn’t offer a fix, that’s quite an oversight.

sledzeppelin
Автор

Thanks for the video,
You could possibly solve the problem by using a persistent state provider to store the loaded data from the prerendering and then load that same data when the interactivity hits.

not useful in this weather page case but could be a good thing when SEO is needed but you dont want to load the data from the database twice.

maybe a good video idea to explore the persistent state provider?

Sander-Brilman
Автор

Thanks, saved me having to work out what this was, well explained, I've been using Blazor for a few years now, sometimes forget to look at new features

songperformer_NET
Автор

I would add that the rendermode is inherited by all components unless otherwise specified in the component itself. Nonetheless I would have added the ability to disable it at the assemplies level. Something like

.AddAdditionalAssemblies(typeof(Counter).Assembly, prerendering: false);

debonagiovanni
Автор

Unfortunately, as you've mentioned in the video, disabling/bypassing Pre-rendering harms SEO and prevents search engines from seeing/indexing page content, even though the solution is useful from a UX point of view.
I eventually had to re-enable it because search engines saw pages as empty.
Are you aware of a better solution that still allows prerendering to remain enabled?

AmerBakeer
Автор

Hi Patrick, love your teaching approach, thank you so much.

BarneyMyBoy
Автор

@PatrikGod In this mode the PageTitle not showing, did you notice that??

codermallu
Автор

Hi, with .net8 new architecture in blazor web app.. where we put custom javascript? in Server project or Client project?

bennyadiwijaya
Автор

Hi Patrick. Thank you so much for the tip. Appreciate it !

AlexandreBeli
Автор

So good videos, I just found your channel! The ability to keep advanced and broad koncepts simple brings so much quality. This has helped me alot were i needed to transition to Angular within my job. If I were to make a request, I would love to see an updated version of a simple .NET project with an Angular client. It would be valuable to see such a project now that Angular's latest version includes new control flow, standalone components, and signals!

andreasnelefelt
Автор

Thanks Patrick for the video.
Could you make a video showing hot to use local storage with blazor 8?

jairvieirajunior
Автор

I'm becoming a big fan of your channel Patrick. Thanks for sharing your vast knowledge.

Reapermk
Автор

You have to wonder why Microsoft would release something so broken, it's like they released it hoping no one would notice the obvious flaw. In short interactive modes don't work without being hacked which in turn creates problems elsewhere in your application.

TrOgaN_
Автор

Will you update your *E-Commerce Website with Blazor WebAssembly* at some point?
I know it's a time issue, so I'm just asking!

ivcbusinesssystems
Автор

Thanks for the great video! Couple of questions here.

First, what's the situation where you do want pre-render? It's the default option, so I'm assuming they thought most pages would use it? But this data-fetching problem would be incredibly common I would think

Second, I don't understand how to juggle the webassembly and SSR. Here you have the same weather page on both WASM and SSR. But what if you want to mix them? It seems weird to me that we have to do a websocket roundtrip request to change state on the server, when it's something like toggling a button that only matters on the frontend.

johnhershberg
Автор

Thank you Patrick for this timely tutorial !

FearGod
Автор

I wish you could tell something about preparing Blazor page for SEO.
I assume it has something in common with rendermode's 'first load'.

adam-xtte
Автор

Hi Patrick, I'm new to your channel and the Blazor world. Great content! Hoping you can answer this question - regardless of the rendering mode, I've noticed when you Network > Preview, that there is "An unhandled error has occurred. Reload" message, which is hidden from the user. Does anyone know what is the cause of this and how to fix?

picturesofplaces
Автор

This concept doesn't seem to stick for me. I am unsure whether to build with Server, WASM, or AUTO.

willgale
Автор

Yikes...these comments are harsh. Lol. For me, the positives far outweigh the negatives with Balzor 8.

They packed a LOT in this release so some combinations or features have questionable defaults...ok.

With the alternatives of waiting till .NET 9, I think they made a great call.

kevinlloyd