Skip to content

Fix mutation observer recovery after errors - #4908

Merged
calebporzio merged 1 commit into
alpinejs:mainfrom
BillyNoyes:fix/mutate-dom-observer-recovery
Sep 15, 2026
Merged

calebporzio merged 1 commit into
alpinejs:mainfrom
BillyNoyes:fix/mutate-dom-observer-recovery

Conversation

@BillyNoyes

@BillyNoyes BillyNoyes commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Restore Alpine's mutation observer in a finally block when a mutateDom callback throws.
  • Preserve the callback's existing return value and error propagation behavior.
  • Add a browser regression test proving later DOM additions are still initialized after an error.

Fixes #4907.

Assisted-By: devx/01a80b4a-afc0-4fff-ab03-cfaf238bf0d9
@BillyNoyes
BillyNoyes marked this pull request as ready for review September 14, 2026 18:36

@BillyNoyes BillyNoyes left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My agent review looks good

@calebporzio
calebporzio merged commit a7e2802 into alpinejs:main Sep 15, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

mutateDom stops observing future mutations when its callback throws

2 participants