Thank you, Patrick. Static SSR goes against the original intentions of the Blazor tooling but it has value and I see why we have it. As they say, "The struggle is real".
Thanks Patrick, I had struggled with the exact same thing. I created a SO post for it, "Implementing and understanding a Blazor Static Server-Side Rendered Counter Page". Same as you, struggling to understand the workflow of static-SSR (SSSR maybe?). When it comes to form submissions, not only is the page reloaded, but you also need to ensure the form being submitted is rendered when it's reloaded, otherwise you will get a misleading error! It feels like static-SSR is more intelligible in MVC compared to Blazor, but once you understand it, it's not really a problem. It does however feel like much more work, so you end up just using interactive-SSR. The next real issue you should do a video on is static-SSR and usage of JS, as JS doesn't really fit with enhanced navigation. There's a nuget package from Mackinnon with the Blazor Team (BlazorPageScript) which works around the problem, but in reality, this feels like a patch until the Blazor Team gets their ducks in a row.
I just load a js file using a normal script tag, and handle most of the logic inside an domcontentloaded event listener, it's a valid workaround, albheit a messy one.
I had to build an app with SSR on the home page and interactive rendering on some admin pages. I ended up creating the home page with a razor page and javascript. I was able to pull static blazor components to the razor page. For my admin pages I used interactive rendering with blazor pages and blazor components. It's like 2 apps in one. 😊
Patrick, great post! It took me days to wrap my head around this. If only.... Are there any considerations on handeling a form this way with for instance multiple buttons/actions? Is that perhaps a subject for another video? Keep up the good work!
This exact thing happened to me a few days ago! It took me like an hour to finally remember something about prerendering issues. Also, I'm currently having another issue. Suddenly I can't run that same project in debug mode. I get an error saying that it failed to launch the browser even tho it actually is opening the browser to a blank page. It works just fine in release mode. I really don't know what caused it. This is just a small test project so I'm not using git. I'm not losing anything important, but it's just annoying to suddenly be stopped by unknown issue
I have my SupplyParameterFromForm attribute and it still gives me null. I am using EditForm with Model property and still the object is not back after form submission, its driving me insane
it seems like my object was too complex, I was trying to use [SupplyParameterFromForm] on a db entity with virtual ICollections. When I switched it to a simple DTO, it worked.
Thank you, Patrick. Static SSR goes against the original intentions of the Blazor tooling but it has value and I see why we have it.
As they say, "The struggle is real".
Blazor Pages is basically the new web forms but with a component model. It actually has its use cases.
IS there no IsPostBack like there is in web forms? Because you had the same basic thing there.
Thanks Patrick, I had struggled with the exact same thing. I created a SO post for it, "Implementing and understanding a Blazor Static Server-Side Rendered Counter Page". Same as you, struggling to understand the workflow of static-SSR (SSSR maybe?). When it comes to form submissions, not only is the page reloaded, but you also need to ensure the form being submitted is rendered when it's reloaded, otherwise you will get a misleading error! It feels like static-SSR is more intelligible in MVC compared to Blazor, but once you understand it, it's not really a problem. It does however feel like much more work, so you end up just using interactive-SSR. The next real issue you should do a video on is static-SSR and usage of JS, as JS doesn't really fit with enhanced navigation. There's a nuget package from Mackinnon with the Blazor Team (BlazorPageScript) which works around the problem, but in reality, this feels like a patch until the Blazor Team gets their ducks in a row.
I just load a js file using a normal script tag, and handle most of the logic inside an domcontentloaded event listener, it's a valid workaround, albheit a messy one.
I learned a lot thanks to your videos. Thank you for your effort
I had to build an app with SSR on the home page and interactive rendering on some admin pages. I ended up creating the home page with a razor page and javascript. I was able to pull static blazor components to the razor page. For my admin pages I used interactive rendering with blazor pages and blazor components. It's like 2 apps in one. 😊
Patrick, great post! It took me days to wrap my head around this. If only.... Are there any considerations on handeling a form this way with for instance multiple buttons/actions? Is that perhaps a subject for another video? Keep up the good work!
This exact thing happened to me a few days ago! It took me like an hour to finally remember something about prerendering issues.
Also, I'm currently having another issue. Suddenly I can't run that same project in debug mode. I get an error saying that it failed to launch the browser even tho it actually is opening the browser to a blank page. It works just fine in release mode. I really don't know what caused it. This is just a small test project so I'm not using git. I'm not losing anything important, but it's just annoying to suddenly be stopped by unknown issue
I have my SupplyParameterFromForm attribute and it still gives me null. I am using EditForm with Model property and still the object is not back after form submission, its driving me insane
it seems like my object was too complex, I was trying to use [SupplyParameterFromForm] on a db entity with virtual ICollections. When I switched it to a simple DTO, it worked.
You saved my time bro...💖
thanks for the heads up
I went all-in with Blazor but do regret not going the React route as Blazor is in danger of becoming a hot mess.
Videos are gettin kinda click-baitey. :|
Idk this legit looks like an issue I could spend hours on if I didnt know about it