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

JSInterop improvements #8404

Closed
javiercn opened this issue Mar 11, 2019 · 3 comments
Closed

JSInterop improvements #8404

javiercn opened this issue Mar 11, 2019 · 3 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Comments

@javiercn
Copy link
Member

Right now we just throw an exception when JSInterop gets called within prerendering. We want to provide a better experience for that. There are a few ideas:

  • Add Try**** extension methods to JSInterop that will not throw.
  • Add some way to figure out whether we are prerendering or not.
  • Provide a directive to indicate that a given component can't be prerendered and put a placeholder instead.
@DNF-SaS
Copy link

DNF-SaS commented Mar 11, 2019

Please also check why await JsRuntime.InvokeAsync() awaits forever when used in Component.OnInitAsync() - it's a real show-stopper if an application needs data from JS for initialization.
See here: #8274

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 11, 2019
@SQL-MisterMagoo
Copy link
Contributor

While we wait for an official solution, I have provided a nuget package to expose the PreRendering status
https://www.nuget.org/packages/PreRenderComponent/
It just uses a CascadingValue to share "IsPreRendering" with your components/pages.

@SteveSandersonMS
Copy link
Member

I'm going to close this in favour of #8786, because there is now more detail over there.

@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-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

No branches or pull requests

5 participants