Save Hours Of Struggle Knowing How To Solve This Blazor SSR (Static Server Side Rendering) IssueðŸ”Ĩ

āđāļŠāļĢāđŒ
āļāļąāļ‡
  • āđ€āļœāļĒāđāļžāļĢāđˆāđ€āļĄāļ·āđˆāļ­ 29 āļ•.āļ„. 2024

āļ„āļ§āļēāļĄāļ„āļīāļ”āđ€āļŦāđ‡āļ™ • 17

  • @SBDavin
    @SBDavin 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +4

    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".

    • @pilotboba
      @pilotboba 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +2

      Blazor Pages is basically the new web forms but with a component model. It actually has its use cases.

  • @williameduardo7020
    @williameduardo7020 2 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

    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. 😊

  • @codefoxtrot
    @codefoxtrot 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +1

    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.

    • @phewdablack1404
      @phewdablack1404 6 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

      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.

  • @pilotboba
    @pilotboba 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +3

    IS there no IsPostBack like there is in web forms? Because you had the same basic thing there.

  • @DeBuie
    @DeBuie 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +2

    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!

  • @adam-xt8te
    @adam-xt8te 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +3

    I learned a lot thanks to your videos. Thank you for your effort

  • @supercyclone8342
    @supercyclone8342 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

    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

  • @sikor02
    @sikor02 2 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

    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

    • @sikor02
      @sikor02 2 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

      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.

  • @liammcmullen4497
    @liammcmullen4497 6 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

    thanks for the heads up

  • @ashiquebinraheem
    @ashiquebinraheem 5 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

    You saved my time bro...💖

  • @chairmakerPete
    @chairmakerPete 5 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

    I went all-in with Blazor but do regret not going the React route as Blazor is in danger of becoming a hot mess.

  • @philipatha
    @philipatha 7 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +1

    Videos are gettin kinda click-baitey. :|

    • @slowjocrow6451
      @slowjocrow6451 6 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +1

      Idk this legit looks like an issue I could spend hours on if I didnt know about it