Skip to content

[Components] Figure out layering on the server #7807

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

Closed
javiercn opened this issue Feb 21, 2019 · 3 comments
Closed

[Components] Figure out layering on the server #7807

javiercn opened this issue Feb 21, 2019 · 3 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one

Comments

@javiercn
Copy link
Member

We want MVC and Components.Server to play nice together.

  • MVC has a basic (non-interactive) prerender
  • Components.Server has a nicer prerenderer (that supports interactivity).
  • We want Components.Server to take over transparently.

They both end up needing some sort of shared abstraction that defines "prerrendering".

  • We can leave Components referencing MVC (as it does today).
  • We can invert the relationship and have MVC reference components.Server
  • We can put the abstractions in Microsoft.AspNetCore.Components but that limits the expressiveness and doesn't apply to WebAssembly scenarios.
  • We can create a new assembly that is where the shared abstractions between the server components live.
    • Microsoft.AspNetCore.Components.Http
    • Microsoft.AspNetCore.Components.Core
    • Microsoft.AspNetCore.Components.Html
    • Microsoft.AspNetCore.Components.Prerendering
@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 21, 2019
@javiercn
Copy link
Member Author

We discussed this at length and we decided on the following.

  • There will be two separate gestures for rendering components from an MVC page/view:

    • "static rendering": Using a component as a partial.
    • "interactive rendering": Prerending some content + reconnecting to the content.
  • MVC will have it's own internal mechanism for performing "static rendering".

  • MVC will not have out of the box will not have it's own mechanism for "interactive rendering".

  • We will create a new library Microsoft.AspNetCore.Mvc.Prerendering that will reference both MVC and Components.Server and will include a couple of extension methods on HTML Helper that can be used for performing "interactive rendering".

    • This library will be part of the shared framework, so it's available to users without anything magic.
    • This library will simply contain a couple of HTML helpers for doing the interactive prerendering.
    • The html Helpers in this library will rely on an abstraction that lives in Components.Server to perform the prerendering and will resolve it from DI or throw otherwise with a clear exception message informing the user that they need to call AddComponents()

@rynowak
Copy link
Member

rynowak commented Feb 23, 2019

Sounds right 👍

@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Mar 25, 2019
@mkArtakMSFT
Copy link
Member

@javiercn, is there anything pending here? If so, please update the post to reflect on it.

@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Apr 3, 2019
@javiercn javiercn closed this as completed Apr 4, 2019
@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one
Projects
None yet
Development

No branches or pull requests

4 participants