-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Follow-ups to lazy-load from API review #24169
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
Conversation
401110f
to
bff6766
Compare
const resourcePromises = Promise.all(assembliesToLoad | ||
.filter(assembly => lazyAssemblies.hasOwnProperty(assembly)) | ||
if (!lazyAssemblies) { | ||
throw new Error("No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noice
throw new Error(`${notMarked.join()} must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading.`); | ||
} | ||
|
||
const resourcePromises = Promise.all(assembliesMarkedAsLazy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't see how this can work asynchronously without doing so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We return a promise in L305. This is the same thing we were doing before for this scenario.
Do you mean that we need to return a Promise in the scenarios where we are currently throwing an error?
This is the main change in this commit since we previously returned a dummy Promise.resolve(0)
if the parameter was invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, yes I think you're right @captainsafia. There was something about the diff (the removal of line 348) that made it look as if we were now discarding this promise. I didn't read it clearly enough.
src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs
Outdated
Show resolved
Hide resolved
src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs
Outdated
Show resolved
Hide resolved
src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. This is now a super thought-through feature :)
src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs
Outdated
Show resolved
Hide resolved
src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs
Outdated
Show resolved
Hide resolved
e996f31
to
d2d2af8
Compare
d2d2af8
to
f98d0a4
Compare
@mkArtakMSFT This should be good to merge now! |
OnNavigateAsync == null
belowawait previousOnNavigate
to ensure that previous on navigates complete even if onNavigateAsync parameter is removedExceptionDispatchInfo.Throw
instead ofExceptionDispatchInfo.Capture.Throw
for re-throwing errors and preserving contextgetLazyAssemblies
on-call for invalid inputsIJSRuntime
Assembly.Load
to verify if assemblies have already been loaded during pre-rendering