Is there a way to have the layout initialization(async) come before the page body initialization?

Today I was surpriced by this finding. Blazor Layout call on OnInitializedAsync() is being called after the Pages own OnInitializedAsync() and this comes with issues when I want to get, for example, the user settings and have them cached in localStorage so each page later-on can gather and act upon this settings appropriately.

Is it supposed to be like this? And if yes, is there any workaround to make it so that the Layout initialization ends before committing to the initialization of pages?

Or there is another possibility, which is: given that all this calls are asyncronous(both the savings to the localStorage and the GET of the user settings) there might be a timeframe where one task is completed quicker than the other.


I figured out in the end that the best place is at the authentication step, where I can receive this extra data, save it to localStorage and then it can be safely got on each authorized page.