1 Critical Blazor Mistake to Avoid in 2024: Interactive Auto Render Mode

  Рет қаралды 7,667

Patrick God

Patrick God

Күн бұрын

Пікірлер: 32
@julienbarach6620
@julienbarach6620 3 ай бұрын
Finally someone talking about the main issue with the Auto mode. Blazor templates are not as ready to go (except for Server) as they were with .Net 7. New developers will think that Auto is the default mode and the best of both worlds but you are always dealing with two modes (Server and WASM) that are fondamentally different and no one is telling you that it's dangerous. API calls are one example but you'll find even more complex issues when you'll want to use localSotrage for instance. So be careful when you want to use the Auto mode. It's sexy on the paper but it can lead to big headhaches and too much complexity for nothing.
@alexmadnix
@alexmadnix 3 ай бұрын
Useful information!☺
@DevilMadeMeDoIt666
@DevilMadeMeDoIt666 3 ай бұрын
What’s the issue with local storage?
@imashar
@imashar 2 ай бұрын
​@@DevilMadeMeDoIt666You cannot access localStorage on the server.
@der-mit-dem-rotwild-tanzt
@der-mit-dem-rotwild-tanzt 3 ай бұрын
This rendermode stuff is really confusing. Thanks for this great explanation and sample!
@waynehawkins654
@waynehawkins654 6 сағат бұрын
Amazing. Thank you so much for this. I did more then click 'Like'. Now I have discovered your channel, I will be seeing what else you can tech me.
@SBDavin
@SBDavin 2 ай бұрын
Going out on a limb here... For a new "WebAssembly" or "InteractiveAuto" project, I think it's a mistake to assume the non-client project is the server. I think it's simply two client projects. Both DLLs are downloaded to the web browser with the .NET wasm runtime. The purpose of the two projects are just to break up the pages based on their render modes. After all, why would a server project have a reference to a client project? It's just weird. It goes against all my development experience. We Blazor developers continue asking the question, "What was Microsoft thinking?" while we try to make sense of the two VS projects, blaming ourselves for not understanding it and trying to mold the code into the .NET 7 project pattern. I think if we want a server project, we should just add a separate Web API project like in .NET 7. Thank you as always, Patrick.
@lucasmegaloja
@lucasmegaloja Ай бұрын
+1 subscriber for clarity and great content!
@PatrickGod
@PatrickGod Ай бұрын
Thank you so much! Means a lot! ❤️
@patrickkuhnel9531
@patrickkuhnel9531 16 сағат бұрын
Danke!
@stefanobompieri5836
@stefanobompieri5836 12 күн бұрын
Hi, i set up a project with just WebAssembly and there is a similar problem: on first run , it works but if i reload the pagine, it says "No services injected". If i inject the services also in the api project it works. It's so strange. Than does any kind of interactive mode needs a service in api project and client project ?
@krrk7356
@krrk7356 3 ай бұрын
How do you think it is possible to turn these 2 separate services into server and client. For separate instances of the mediator. We inject the mediator into the component. If it runs on the server then it uses the corresponding handler. If on the client, then the corresponding handler does the http query. And the controller uses the mediator from the server.
@webmaster4095
@webmaster4095 3 ай бұрын
Привет, рекомендую посмотреть портированную библиотеку redux-blazor. Она отлично работает с обновлением состояния.
@tajmaut2
@tajmaut2 3 ай бұрын
what about it in MudBlazor??
@samerelsahih
@samerelsahih 3 ай бұрын
Total chaos. I still can't seem to run it correctly on both server and client side
@jaytandon
@jaytandon 3 ай бұрын
Agreed, hopefully dotnet 9 makes Mudblazor work better
@imSkod
@imSkod 3 ай бұрын
I think this title should just be like 'how to use services in Auto rendermode' or something similar. Good explanation and video though
@LlamaNL
@LlamaNL 8 күн бұрын
This is ridiculous, look at the amount of boilerplate just to get a single array! Now imagine if you have 10 controllers each with a 4 endpoints!!!
@Rks1926
@Rks1926 2 ай бұрын
Great stuff, thank you!
@webmaster4095
@webmaster4095 3 ай бұрын
Привет, Мир! Я начал использовать Blazor 8 и столкнулся с проблемой контроля за персистентностью состояния при использовании режима AutoInteractive, где почитать/посмотреть лучшие практики по данному режиму рендеринга?
@bou7eliw
@bou7eliw 3 ай бұрын
Hi, please could show us how we can do an authentification using active directory? Please
@Conjuredfilms
@Conjuredfilms 3 ай бұрын
Hi Patrick I saw you're looking for an editor! I'm available and emailing you.
@jmmoyadev
@jmmoyadev 17 күн бұрын
Great explanation! But all this workaround this is why Blazor will die sooner than later... So, you have to create two implementations for the same service, one in client, and one in server? And the API endpoint too... now do that for a big application with 10 controllers, with 4 or 5 endpoints or more, and at least another 10 services with another 5, 6.. 10 methods? C'mon... what a waste of time...
@kvelez
@kvelez 2 ай бұрын
Cool
@Hasan10-oh7vl
@Hasan10-oh7vl 3 ай бұрын
Love ittt!!! You need a video editor bro ? I can do a sample video 👊🏽
@mtranchi
@mtranchi 3 ай бұрын
No way I could bring myself to make two database calls for every page load across every web app I run.
@kijanawoodard
@kijanawoodard 3 ай бұрын
Wouldn’t it just be for the initial load and then you’re pure web assembly after that?
@mtranchi
@mtranchi 3 ай бұрын
@@kijanawoodard No it doesn't work that way. Put a break point on your controller and you'll see the endpoint gets hit twice: once from the server, again from the client... though... i already can't remember how Patrick set up his code, so not sure about his implementation, lol. however, there's a super simple check built in to Blazor 8 where you can check if the component is being rendered on the server or in the web browser. You can use that to (pseudo code) "if(Environment.IsBrowser)" in your OnInitializedAsync to decide whether you want the db to be hit on the server or in the browser. Comment on this, when i get a chance, i'll find it, post it back here
@markhill1066
@markhill1066 3 ай бұрын
Your not supposed to, the first database call which happens via SSR fetches the data which is then added to the persistent state. When the component/page is loaded in wasm it loads data from the persistent state. So SSR is for the initial load, WASM handles incremental updates.
@mtranchi
@mtranchi 3 ай бұрын
@@markhill1066That's the way it should be, but not according to my break-point when debugging. The `controller` `action` that fetches the data from the db gets hit twice, 100% certain it is so in Blazor 8 because i've spent copious hours working to eliminate one of the calls.
@slynch401k
@slynch401k 25 күн бұрын
@@markhill1066 That is if it ever switches over, it is so overengineered and basically doesn't work most of the time.
go is great i hate it
14:44
SST
Рет қаралды 27 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
.NET and C# are in trouble. Here is what I'd do.
10:57
Ed Andersen
Рет қаралды 119 М.
Why Every .NET Developer NEEDS Dependency Injection
10:00
Patrick God
Рет қаралды 12 М.
The Blazor Competitor is Here!
15:08
Nick Chapsas
Рет қаралды 76 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
Blazor WebAssembly vs Blazor Web App - Which Is Best?
7:56
AWS Developers
Рет қаралды 5 М.
What are the Different Types of Rebreathers? | SCUBA 101
27:39
BlueWorld_plus
Рет қаралды 40 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.