Closed garrettlondon1 closed 3 months ago
@garrettlondon1 thanks for contacting us.
Is the issue that the event is not being raised?
Hi @javiercn, the event does get raised actually
Additionally,
<script>
Blazor.start({
ssr: { disableDomPreservation: true }
});
</script>
This opens up a new socket connection every time you switch pages, so the developer can't really turn off enhanced nav if using InteractiveServer
As a note, you can disable enhanced load on specific pages using the data-enhance-nav
attribute.
<a href="redirect" data-enhance-nav="false">
GET without enhanced navigation
</a>
This ensures that the page you're navigating to will always load completely. Cheers.
As a note, you can disable enhanced load on specific pages using the
data-enhance-nav
attribute.<a href="redirect" data-enhance-nav="false"> GET without enhanced navigation </a>
This ensures that the page you're navigating to will always load completely. Cheers.
Problem with this is a new websocket is opened every time
Before we address this in https://github.com/dotnet/aspnetcore/issues/52273, a possible workaround is to register a custom element on the initial page load and define some custom logic in its lifecycle callbacks. Then you can render that custom element on any page that requires its functionality. You could even use HTML attributes to augment the custom element's behavior.
For example, the PageScript sample component is a general-purpose application of this technique, and it lets you specify an arbitrary JS module with callbacks for handling navigation events (including enhanced navigation). Some people have had success with that. It would probably help with this specific issue as well.
In the meantime, I'm going to close this out as a dupe of https://github.com/dotnet/aspnetcore/issues/52273, since the concerns expressed in this issue appear to be accurately reflected there.
Is there an existing issue for this?
Describe the bug
Enhanced load will not reprocess HTMX if its loading the same page
HTMX will reprocess if any other page is loaded, with enhanced navigation on using script below
Disabling enhanced navigation does fix this, with data-enhance-nav=false
Expected Behavior
Reloading the same page you are currently on from the navlink, properly re-executes htmx scripts on the same page through enhancedload callback.
This is the last hiccup between completing the bridge between InteractiveServer islands and Minimal API HTMX partials on the same StreamRendered page. The ultimate combination
Steps To Reproduce
https://github.com/garrettlondon1/BlazorHtmx
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response