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

Loaders - check if node exists in DOM before attaching handler? #10

Open
madsenmm opened this issue Oct 7, 2024 · 0 comments
Open

Loaders - check if node exists in DOM before attaching handler? #10

madsenmm opened this issue Oct 7, 2024 · 0 comments

Comments

@madsenmm
Copy link
Member

madsenmm commented Oct 7, 2024

As the title says, there are cases where content is replaced entirely, but the components initial loader on mount still exists, and therefore triggers multiple times, and then behaves unexpectedly because of sudden multiple triggers on non-existent elements in the DOM.

Current fixes

// Bail early if node doesn't exists anymore
if (!document.body.contains(node)) {
  return;
}
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