Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example of mixed interactive server render mode and SSR #464

Closed
silajim opened this issue Jan 30, 2025 · 13 comments · Fixed by #471
Closed

Add example of mixed interactive server render mode and SSR #464

silajim opened this issue Jan 30, 2025 · 13 comments · Fixed by #471

Comments

@silajim
Copy link

silajim commented Jan 30, 2025

I can't find anywhere a proper example on how to implement this: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0#area-folder-of-static-ssr-components

It would be nice to have an example on how to mix both

@guardrex
Copy link
Collaborator

Hello @silajim ... Yes, this is a reasonable request. Let me see what I can do. I hate to create an entirely new sample just for this. However, I also don't want to make our existing samples being used for other scenarios more complicated than they need to be. I'll get back to you. The good news is that if you follow that section, you should have a good outcome. I recall setting up that section, and the guidance worked here locally in a test app at the time that was written. If it fails for you, please open an issue from the bottom of that article. Either way tho, leave this issue open for work over here. Thanks for writing in on it!

@silajim
Copy link
Author

silajim commented Jan 30, 2025

It would be greatly appreciated, I tried following it, but I can't seem to get it right, as someone new to this, it seems a bit complex to get it right.

@guardrex
Copy link
Collaborator

I see. I'll try to get to this next week, but no promises. I have two high priority sample apps to place ... and third sample if the Blazor Hybrid sample has to go up in the MAUI part of our docs. I'll get to this as soon as I can.

@MarkusKirschnerLumivero
Copy link

I would also appreciate it, if you could find the time to add this example.

@guardrex
Copy link
Collaborator

guardrex commented Feb 4, 2025

I'm BACK!

The first thing that I'll do this morning is walk the guidance to see if/how to improve it. I'll also probably put up a sample for you, but I can't say if I'll place it as a formal Blazor samples repo sample. What I might do is just stick it into my personal repo so that you can get it from there. The problem with adding it as a full-blown Blazor repo sample is that it doesn't offer a lot of benefit for the amount of overhead that it takes to keep it up to date release to release.

I'll get back to you shortly .............

@guardrex
Copy link
Collaborator

guardrex commented Feb 4, 2025

Ugh! Yeah ... I see what you mean. It's a bit messy, and new developers, new-to-.NET developers, and new-to-Blazor developers are going to be thrown by the complexity of the setup.

I am thinking now that a full sample app for this setup makes sense.

I also don't want to roll this into an existing auth sample because then devs have to untangle and remove it if they don't want it.

@guardrex
Copy link
Collaborator

guardrex commented Feb 4, 2025

Oh, yes, indeed! PR coming soon. I'm adding a sample for each of these ...

  • Area (folder) of static SSR components
  • Static SSR components spread out across the app

@silajim
Copy link
Author

silajim commented Feb 4, 2025

Thank you! I appreciate the work you are putting in

@guardrex
Copy link
Collaborator

guardrex commented Feb 4, 2025

My pleasure.

Be sure to check out the @attribute [ExcludeFromInteractiveRouting] Razor component directive that arrived for 9.0 or later. You just need to load the main section for 9.0 to read about that ...

Static SSR pages in a interactive app (ASP.NET Core 9.0 or later)

Otherwise tho, both of these techniques do work in 9.0 or later, so if the attribute doesn't meet your needs, then either of these approaches are supported and work just fine.

@guardrex
Copy link
Collaborator

guardrex commented Feb 4, 2025

... but note that I changed a section heading. That link ☝ should go live in about 10 minutes or so on the documentation website.

@silajim
Copy link
Author

silajim commented Feb 4, 2025

Is saw the @Attribute [ExcludeFromInteractiveRouting] and I tried to use it, until I saw it was for 9.0. I am using 8.0 because it's lts

@guardrex
Copy link
Collaborator

guardrex commented Feb 4, 2025

That's cool. You can use it for 8.0 or later without a problem. It's just that the team wanted to make it a little easier with the attribute going forward in 9.0 or later. We did disable these sections for 9.0, so we're kind'a pushing people to use the attribute. However, these techniques should continue to work fine going forward.

@silajim
Copy link
Author

silajim commented Feb 4, 2025

Great, good to know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants