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

Prerendering and interactive/enhanced routing #31353

Merged
merged 5 commits into from
Jan 5, 2024

Conversation

guardrex
Copy link
Collaborator

@guardrex guardrex commented Jan 4, 2024

Fixes #31351

Mackinnon ...

Even if this is heading in the right direction, we probably have muddled wording for "interactive routing" and "enhanced navigation." Are they the same? ... because we're blending the language in discussion and in articles [e.g., "interactive (enhanced) routing" or "interactive (enhanced) navigation"]. If the following pairs reflect the same concepts, there's more work to do here ...

  • "static" and "non-enhanced" ... same thing?
  • "interactive" and "enhanced" ... same thing?
  • "routing" and "navigation" ... same thing?

If possible, I think we should use consistent terminology everywhere. If I'm grouping compatible concepts, which of the following is the best pair to use? ... and should we loop all of the Blazor PU into this discussion?

  • Option 1
    • "static (non-enhanced) routing"
    • "interactive (enhanced) routing"
  • Option 2
    • "static (non-enhanced) navigation"
    • "interactive (enhanced) navigation"
  • Option 3
    • "static (non-enhanced) routing and navigation"
    • "interactive (enhanced) routing and navigation"
  • Option 4
    • "static routing (non-enhanced navigation)"
    • "interactive routing (enhanced navigation)"
  • Option 6 (probably not viable given that general discussion, convos, issues, etc. use "enhanced navigation" lingo quite a bit)
    • "static routing"
    • "interactive routing"
  • Option 7 (probably not viable because "interactive routing/router" lingo is used quite a bit)
    • "enhanced navigation"
    • "non-enhanced navigation"

Additionally, we've introduced "static router" and "interactive router" in just a couple of spots, and I hope to limit the use of those terms to just the few spots we have them.


Internal previews

📄 File 🔗 Preview link
aspnetcore/blazor/components/cascading-values-and-parameters.md ASP.NET Core Blazor cascading values and parameters
aspnetcore/blazor/components/prerender.md Prerender ASP.NET Core Razor components
aspnetcore/blazor/fundamentals/routing.md ASP.NET Core Blazor routing and navigation

@guardrex guardrex self-assigned this Jan 4, 2024
@guardrex guardrex requested a review from MackinnonBuck January 4, 2024 12:58
@MackinnonBuck
Copy link
Member

I would say there are two main categories of routing:

  • Static (server-side) routing
  • Interactive (client-side) routing

Static routing is where the page content gets determined by making an HTTP request to the server and displaying the response HTML on the page.

Interactive routing generates page content without requiring the server to render HTML to get displayed on the page.

Note: I've personally sometimes used the terms "server-side" and "client-side" rather than "static" and "interactive" because those are the terms that the rest of the industry tends to use. It just happens to be confusing in Blazor's case because a router with Server interactivity has the characteristics of a client-side router, while the routing logic is technically running on the server.


  • "routing" and "navigation" ... same thing?

I think of navigation as the act of moving from one page to another. Routing is the act of mapping a URL to page, which is one of the mechanisms required to enable navigation.

  • "static" and "non-enhanced" ... same thing?
  • "interactive" and "enhanced" ... same thing?

"Enhanced" navigation is a variation of "static" navigation. A non-enhanced navigation is just a normal static navigation that clears all JS/DOM state as the navigation occurs. These are the types of navigations you would get in a Razor Pages app, for example. An enhanced navigation works similarly, except it attempts to preserve as much browser-side state as possible when displaying the new HTML returned from the server.

So the hierarchy of these terms is:

  • Static/server-side navigation
    • Enhanced navigation
    • Non-enhanced navigation
  • Interactive/client-side navigation

Hopefully that makes sense! I don't have a very strong opinion about whether "server/client" or "static/interactive" are the right set of terms to use. Maybe @danroth27 has thoughts on this?

@guardrex
Copy link
Collaborator Author

guardrex commented Jan 4, 2024

Thanks @MackinnonBuck ... I'll digest that for a round of updates to this PR on Friday morning.

Is what's on the PR good thus far?

@guardrex
Copy link
Collaborator Author

guardrex commented Jan 4, 2024

If we have a change thus far just for what's on the PR now, it will likely be for the language ...

interactive (enhanced) routing

aspnetcore/blazor/components/prerender.md Outdated Show resolved Hide resolved
aspnetcore/blazor/components/prerender.md Outdated Show resolved Hide resolved
aspnetcore/blazor/components/prerender.md Outdated Show resolved Hide resolved
Co-authored-by: Mackinnon Buck <mackinnon.buck@gmail.com>
@guardrex
Copy link
Collaborator Author

guardrex commented Jan 5, 2024

@MackinnonBuck ... I looked over your remarks. I think we have most of that already covered fairly well in the Routing article per our pre-holiday work. It's in two sections ...

However, we don't have the cross-cutting list that you provided ...

So the hierarchy of these terms is:

  • Static/server-side navigation
    • Enhanced navigation
    • Non-enhanced navigation
  • Interactive/client-side navigation

... because we keep the subjects in two separate sections. I'm not sure if we should add more content to the Enhanced navigation and form handling section or not.

One thing came up in my review of the content. I had messaged you about what I perceived to be 👽 behavior of the Persistent Component State service, but it was covered in Routing after all ...

Interactive routing also prevents prerendering because new page content isn't requested from the server with a normal page request.

... a bit buried as the last sentence of a paragraph and certainly something that would be easy to forget over the holiday break. This PR will now make it clear in the Prerender article. I'm going to make that a new paragraph there and add a cross-link from that remark in the Routing article to this new Prerender article content.

I've also added the remark to the Interactive routing subsection of the Route to components from multiple assemblies section, also with a cross-link to the new Prerender article content.

The requested review changes have been made to this PR. Would you give it a final look to see if it's good to go?

Copy link
Member

@MackinnonBuck MackinnonBuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - I have one more piece of feedback but feel free to address it however you like 🙂

aspnetcore/blazor/components/prerender.md Outdated Show resolved Hide resolved
@guardrex guardrex merged commit e870670 into main Jan 5, 2024
3 checks passed
@guardrex guardrex deleted the guardrex/prerendering-with-interactive-routing branch January 5, 2024 17:09
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 this pull request may close these issues.

Add remarks on prerendering with interactive routing
3 participants