Load satellite resources before rendering root components (#20299)
* Load satellite resources before rendering components
This commit is contained in:
commit
df1252a3f8
|
|
@ -120,6 +120,12 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting
|
||||||
|
|
||||||
_started = true;
|
_started = true;
|
||||||
|
|
||||||
|
// EntryPointInvoker loads satellite assemblies for the application default culture.
|
||||||
|
// Application developers might have configured the culture based on some ambient state
|
||||||
|
// such as local storage, url etc as part of their Program.Main(Async).
|
||||||
|
// This is the earliest opportunity to fetch satellite assemblies for this selection.
|
||||||
|
await SatelliteResourcesLoader.LoadCurrentCultureResourcesAsync();
|
||||||
|
|
||||||
var tcs = new TaskCompletionSource<object>();
|
var tcs = new TaskCompletionSource<object>();
|
||||||
|
|
||||||
using (cancellationToken.Register(() => { tcs.TrySetResult(null); }))
|
using (cancellationToken.Register(() => { tcs.TrySetResult(null); }))
|
||||||
|
|
@ -134,10 +140,6 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting
|
||||||
await _renderer.AddComponentAsync(rootComponent.ComponentType, rootComponent.Selector);
|
await _renderer.AddComponentAsync(rootComponent.ComponentType, rootComponent.Selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Users may want to configure the culture based on some ambient state such as local storage, url etc.
|
|
||||||
// If they have changed the culture since the initial load, fetch satellite assemblies for this selection.
|
|
||||||
await SatelliteResourcesLoader.LoadCurrentCultureResourcesAsync();
|
|
||||||
|
|
||||||
await tcs.Task;
|
await tcs.Task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue