Skip to content
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

Events htmx:afterRequest / htmx:afterOnLoad not fired in some cases #2547

Open
Ramblurr opened this issue May 15, 2024 · 0 comments
Open

Events htmx:afterRequest / htmx:afterOnLoad not fired in some cases #2547

Ramblurr opened this issue May 15, 2024 · 0 comments

Comments

@Ramblurr
Copy link

Problem

The htmx:afterRequest and htmx:afterOnLoad events are not being fired when the DOM no longer contains the element nor any of its hierarchy.

Background

I have a popup action menu powered by tippy that dynamically positions some buttons. These buttons cause htmx requests.

2024-05-15_09-13-52

By the time the HTMX request is complete, the entire dom subtree of that menu (including the trigger button) have been removed from the DOM.

This results in htmx:afterRequest and htmx:afterOnLoad events not being triggered.

Debugging

image

Indeed, the trigger's parent hierarchy bottoms (tops?) out without getting to <body>.
2024-05-15_09-11-32

@Ramblurr Ramblurr changed the title Events afterRequest / afterOnLoad not fired in some cases Events htmx:afterRequest / htmx:afterOnLoad not fired in some cases May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant