-
Notifications
You must be signed in to change notification settings - Fork 8
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
Possible race condition showing Blazor NimbleDialog during OnAfterRenderAsync #2188
Comments
Our docs say to include the script in Some other ideas on top of moving the script loading to
|
The default Blazor project templates have seen some significant updates with the last couple .NET releases. I believe With the .NET 8 template, which is what I used for the reproducing example, those tags have moved into I'm not sure what has changed, but today I've been unable to reproduce using the above steps to reproduce. But it still does reproduce in our full application. I'll try moving the Nimble script first in our full app and see if that helps. |
With the Nimble script moved first in our full app, I've been unable to reproduce this after dozens of attempts. With the Blazor script moved back in front, I can reproduce within a few attempts. So that appears to be a fix, and I don't notice any other differences in behavior. @rajsite Do you think that's the correct fix, or is there something else I should try? |
@epetersoni, could you provide some more clarity around what specific scripts you are arranging? When you say "Nimble script" are you referring to the workaround script (I presume not, as I think we've realized that this isn't relevant), or the all-components script? Presuming the latter case, it's not clear why your changes would be correcting the problem, but we don't believe it should be problematic either. The larger concern, which I think @rajsite can expand on if needed, is whether or not there is an underlying issue (or expectation) that Microsoft has introduced for how scripts are loaded in a Blazor app. The working theory is that no scripts would attempt to be executed until after |
@atmgrifter00 It is the latter case - I moved the all-components script to before the Blazor server script. Some of our end-to-end tests which were already slightly intermittent started to fail much more frequently around the time of this change, but I'm not clear on how that might be related. |
@epetersoni - I've re-tested this along with the .NET 8 changes going into Nimble soon ( #2454 ), but I'm unable to reproduce it still (in a standalone test app). If you still see it once we publish the .NET 8 changes, we can diagnose it further then. (What I tried - new Blazor Web App in Visual Studio, InteractiveServer render mode (interactivity location = global), made the changes you outlined in the original issue, and the scripts are in App.razor as the following: <script src="_framework/blazor.web.js"></script>
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
<script src="_content/NimbleBlazor/nimble-components/all-components-bundle.min.js"></script> ) |
# Pull Request ## 🤨 Rationale Resolves #1667 - Split off resolving more code analysis suppressions to #2453 - #2355 : Resolved by updates to Nimble/Spright JS initialization scripts for .NET 8 - #2188 : Not reproducible by Nimble team, can debug further once changes published if client can still reproduce ## 👩💻 Implementation - Projects in Blazor solution now target `net8.0` (formerly `net6.0`) - Update other .NET dependencies, and code analyzer package versions - Update docs - Re-build `Demo.Server` example based on new Blazor Web App template - Update acceptance test projects to use similar setup as Blazor Web App templates - `NimbleBlazor.Tests.Acceptance.Client`: Existing tests use the `InteractiveServer` render mode. The project also now supports tests using `InteractiveWebAssembly` and static SSR render modes. Add one example test for each. - TODO: Spright acceptance test project currently don't use the new setup yet. If the changes look reasonable and we want to do the same for the Spright tests, I can do so in an update. ## 🧪 Testing - Manual testing - Autotests (unit/acceptance) pass. New tests for Nimble for InteractiveWebAssembly / static SSR render modes. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
@epetersoni NimbleBlazor 19.0.0 is now available which targets .NET 8.0. Note though like I said above we were unable to reproduce this on our side, so no specific changes went in for this issue. Marking this Waiting for Response for now so that you can test out the new version and see if you can still reproduce this. |
@msmithNI I updated our application to Nimble 19.0.0, swapped the order of the Blazor Server / Nimble JS scripts back to having the Blazor one first, and was unable to reproduce the issue. I did notice that with the update JS initialization was not working ( #2355 ). I'm assuming this is because we need to update our Blazor initialization code from the .NET 7 template -> .NET 8 template so that the updated Nimble JS initializers work. Doing so might end up reintroducing this bug. |
🐛 Bug Report
I have a Blazor component containing a
NimbleDialog
that we want to have open when the component first renders. Intermittently (maybe 30% of the time), I get this JavaScript error about not finding theshow
function:💻 Repro or Code Sample
I created a simple reproducing example as follows:
_content/NimbleBlazor/nimble-components/all-components-bundle.min.js
and_content/Radzen.Blazor/Radzen.Blazor.js
scripts inApp.razor
.Home.razor
withNote that I could not get this to reproduce without the Radzen script there in addition to the Nimble one. I suspect the extra script is affecting the timing of loading the Nimble one, such that sometimes it has not been loaded by the time the component renders.
🤔 Expected Behavior
The dialog should successfully render every time.
😯 Current Behavior
The dialog fails to render sometimes and we get a Blazor error.
💁 Possible Solution
A way to resolve the race condition (if that's what happening), or guidance on a way we could have our component wait until it knows the script is ready before trying to open the dialog.
🔦 Context
For Armstrong, we're going to be requesting that the WPF app hosting the sequencer in a web view (InstrumentStudio) be able to show a modal dialog with a web view that displays a Blazor dialog. To implement that Blazor dialog we're creating a component like the one described here, that opens immediately after rendering. Our web app has the Nimble + Radzen scripts as described here, so I'm seeing the issue some of the time.
Note that this is not a requirement for our end of June release, but is required for our C3 work.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: