PopoverService: do not call JS during OnInitializedAsync#7441
Merged
ScarletKuro merged 2 commits intoMudBlazor:devfrom Aug 29, 2023
Merged
PopoverService: do not call JS during OnInitializedAsync#7441ScarletKuro merged 2 commits intoMudBlazor:devfrom
ScarletKuro merged 2 commits intoMudBlazor:devfrom
Conversation
6 tasks
ilovepilav
pushed a commit
to ilovepilav/MudBlazor
that referenced
this pull request
Nov 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I recently spoke with someone experiencing issues with BSS when deployed in a cloud environment. It appears that all components related to popovers exhibit a slight delay during the initial load, which subsequently disappears.
With this #7333, we understand that it's important not to execute any JavaScript during the
OnInitializedAsynclifecycle method. The methodCreatePopoverAsyncis invoked duringOnInitializedAsync, and within it, there's a call toInitializeServiceIfNeededAsync, which itself triggers a JavaScript call and employs a locking mechanism. This is likely the root cause of the delay.In the previous implementation of
PopoverServicethere were no JavaScript+locking on theOnInitializedAsyncphase. My initial intention was to initialize the service as early as possible, but the removal ofInitializeServiceIfNeededAsyncfromCreatePopoverAsyncdoesn't impact functionality. TheInitializeServiceIfNeededAsyncis invoked later in theOnAfterRenderAsynclifecycle anyway, where it should be called.How Has This Been Tested?
I sadly cannot really test if this fixes the delay, as it's hard to replicate the environment where it happens.
However, even if my identification of the root cause of the delay is incorrect, the proposed change is still a valid improvement as this logic doesn't work in prerendering.
Types of changes
Checklist:
dev).