Open epetersoni opened 2 months ago
@epetersoni could you attach a zip of the the .NET 8 you used to reproduce this?
I added this issue as acceptance criteria under #1667 so we'll plan to tackle it as part of that (presumably before .NET 6 goes out of support).
@jattasNI net8_no_nimble_callback.zip
@epetersoni It looks like this is due to the changes to the Blazor startup process and JS initializers for .NET 8.
NimbleBlazor relies on the afterStarted
callback which is now a "classic"/deprecated initializer, which is not called by default.
Blazor provides a way to opt back into the classic initialization behavior, and that looks like a workaround to this issue:
<script src="_framework/blazor.web.js" autostart="false"></script>
<script src="_content/NimbleBlazor/nimble-components/all-components-bundle.min.js"></script>
<script>
Blazor.start({ enableClassicInitializers: true });
</script>
However, that Microsoft page states "However, legacy initializer execution is unpredictable."
Once we update Nimble Blazor to target .NET 8, we'll update our JS initialization code to use the new methods, so it's probably best to wait for that. (HLD for that work)
π Bug Report
Our app was initially created with the Blazor Server App .NET 7 template in VisualStudio. We recently followed the guide to update it to the .NET 8 Blazor Web App template.
It looks like at least some Nimble
EventCallback
s are now not getting invoked. Two examples are theNimbleBanner
OpenChanged
, and theNimbleMenuButton
Toggle
.π» Repro or Code Sample
NimbleBlazor
package (18.0.0
is currently the latest) and required Nimble script / fonts.NimbleBanner
component with anOpenChanged
callback on a page, and withOpen="true"
.π€ Expected Behavior
The
EventCallback
should get invoked.π― Current Behavior
The
EventCallback
is not invoked.π Possible Solution
Official Nimble .NET 8 support. I'm not sure exactly what difference is causing the behavior change.
π¦ Context
Since updating our app to use the .NET 8 template, a few pieces of functionality that were relying on callbacks are now not working.
We didn't have a specific reason for updating to the .NET 8 template, so we'll need to evaluate what all the callback-related bugs are and whether we should revert the update and / or wait for fixes to this bug.
π Your Environment