-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Lazy loading of application areas #5465
Comments
@danroth27 Do you already have a few more details available for how this might work on a conceptual level? E.g. is it envisioned that each lazy-loaded area could be in a separate project/assembly? I'm always interested in scalability beyond the typical demo projects used at conferences and in tutorials... ;-) |
And another aspect that I believe is of interest to people with existing systems: Is there a way to support a hybrid solution, e.g. an ASP.NET MVC application with some parts implemented using Blazor? Is this the wrong question and/or does this warrant creating a separate issue? Perhaps I'm asking to fly to the next galaxy while you guys are trying to just get launched into space in the first place.... |
@ManfredLange Nothing to share on the design for lazy loading quite yet. As for ASP.NET MVC, you can use Blazor with any backend that you'd like including non-.NET back ends like Java, JavaScript, PHP, etc, although we make it particularly easy to use Blazor with ASP.NET Core. However, Blazor today takes full ownership of the app and the DOM, so you can't really use MVC to render some HTML on the server and then use Blazor to manipulate the DOM on the client. We are however looking at server-side pre-rendering support for Blazor. |
@danroth27 link above broken. here's the fixed version server-side pre-rendering, I wish GitHub let you do it the way you tried though. You have to put [24] in brackets rather than [#24] |
@mungojam Thanks! Fixed |
@danroth27 |
@ckams Lazy loading is about being able to break your Blazor app up into multiple areas that can be loaded independently. It's Blazor specific, so not related to ASP.NET Core MVC and server-side rendering. You do get the perf benefits of WebAssembly in the browser. |
@danroth27 |
Nope
Yes, lazy loading allows you to load different areas of your app client-side from the server as needed. It's similar to lazy loading in frameworks like Angular or React. |
I don't see target release. Any idea in which release this feature will be available? |
@abhishekgoenka Sorry, but we don't know when this feature will land quite yet. |
I'm imagining two levels of lazy loading: page level and component level. This will allow the Blazor team to deliver in phases, whichever is easier first (perhaps page level?). At page level, the entire page is lazy loaded. Thus, in an app, a page's assembly is only loaded to the browser until the user clicks on the page's link. A page would have to be declared as lazy (ex. At component level, the component can be declared Thus, the @lazy directive can be used by the engine to generate different wasm's that can be "plugged in" to the client at runtime upon request (via page and/or component that needs it). I'm thinking WebAssembly's dynamic linking comes to play here (if I'm understanding it correctly)? Or perhaps Blazor will provide the mechanism to allow it? |
@danroth27 would it be possible to get any news regarding ETA of lazy loading? |
@hokusp Unfortunately there isn't any news to share at this point. This feature is on our backlog, but we don't expect to get to it any time soon. Our current thinking is that Lazy Loading is not critical for shipping Blazor v1.0. We still want to support it though, and we expect it would ship in a follow on release. To help us ensure that we are prioritizing this feature correctly, it would be great if folks could share with us more details on how you expect to use this feature and why it's important for your scenarios. |
Just because Dan asked 👍 In my opinion, Lazy Loading is essential for Blazor to be able to provide a good support for PWAs and a faster web experience in general. My use case for lazy loading is simply that any page containing its most usable components should be able to be presented to the user within a max of 2 seconds from first visiting the site. This means that both pages and components should be able to be identified as lazy-loaded. Along with lazy loading a page, it would be great if an already loaded page could hint on the next page/components to be loaded and like this triggering a pre-fetching or nav pre-loading mechanism. PWAs can use Service Workers to do pre-fetching but that would not play nicely with Blazor app if no APIs are provided to facilitate it through Blazor. |
For my current project, it would be great if I could load Blazor components as independent modules. |
As for lazy loading, lazy dlls (library projects in general) should be the easiest ones to implement. I don't know a lot about the implementation in this area, sorry if what I'm saying doesn't make sense. |
This is one of the key must-have feature that is missing and keeping us away from adapting Blazor. The concept of representing Areas (https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/areas?view=aspnetcore-2.2) as lazy-load modules would be a good approach. Until this feature is added, it is hard to consider Blazor for medium to large size enterprise applications. Please consider this as a priority feature. |
@danroth27 are there any updates on this? |
@danroth27 Will issue (11212) Nested Routing In Blazor be fixed as part of this ? |
@AmarjeetBanwait Not really. I'd recommend adding any scenarios/thumbs-up you have on the original issue for nested routes. |
Oqtane ( https://github.com/oqtane/oqtane.framework ) is a modular framework built on Blazor and it already supports dynamic loading of "modules" created as razor class libraries ( including dealing with CSS and JS loading concerns ). However the current challenge we encountered with lazy loading is not related to dynamically loading assemblies or instantiating razor components... it is related to moving beyond "hello world" scenarios and creating a real world data-centric client/server plug-in module. A data-centric client/server module will have a Web API Controller which the razor components will call to retrieve data from the server. However it appears that the only way to load a Web API Controller dynamically is during Startup using mvcBuilder.PartManager.ApplicationParts.Add(part); This is an issue for lazy loading as it means that these assemblies must all be identified and loaded during startup and cannot be loaded on demand. Will it be possible in MVC 5.0 to dynamically add ApplicationParts outside of Startup? |
Thanks for participating in this thread everyone! We'll be shipping support for lazy-loading as part of the upcoming preview8 release. Some follow-ups will be shipped in rc1, too. Once preview8 ships, you'll find docs on lazy-loading in Blazor at docs.microsoft.com. Looking forward to hearing your feedback on the feature! |
@captainsafia, when preview 8 will be released? |
@Dennis-Petrov According to the Milestones section, it is scheduled for August 20, 2020. |
No description provided.
The text was updated successfully, but these errors were encountered: