Replies: 1 comment 6 replies
-
Hey, it's weird that the Could you show your HTML code for Other than that, could you try adding a log of Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Hey, it's weird that the Could you show your HTML code for Other than that, could you try adding a log of Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
I am working on an "active search" demo with a loading indicator. And, to make sure the loading indicator works, I've added a 2-second delay to my search results. However, I'm seeing a strange issue in which:
hx-push-url
from the search page updates the browser location even though that UI is no longer rendered.To get around this, I've tried to trigger an
htmx:abort
event on the active search input when the element unloads; but, it doesn't seem to actually do anything. Here's my input code. Three things to note:hx-sync
on the form (to synchronize the active search and the form submission).hx-push-url="true"
on the active search input.hx-on:htmx:before-cleanup-element
on the input.I can see from the
console.log("here")
that thebefore-cleanup-element
event is being fired. However, I can see from the browser network activity that the pending request isn't being aborted; which is why, I presume, I'm seeing the active search URL get pushed onto the history even after I've navigated away.I feel like I must be missing something very subtle. Not sure if the
hx-sync
is messing things up. Or, if maybe the AJAX queue is no longer bound to the element at the time thebefore-cleanup-element
event is fired. Thanks for any advice!Beta Was this translation helpful? Give feedback.
All reactions