Accudio / async-alpine

Async Alpine brings advanced code splitting and lazy-loading to Alpine.js components!
https://async-alpine.dev
Apache License 2.0
152 stars 12 forks source link

Observer unable to listen on body.replaceWith() #22

Closed iniznet closed 1 year ago

iniznet commented 1 year ago

I'm using flamethrower as a client-side router that uses .replaceWith() to update the whole document.body and the observer unable to catch it.

After further investigation, the .replaceWith() seems to create a new body instance resulting in the observer missing its targets to monitor, there's no log coming out after the body is replaced.

For now, I temporarily fix it by changing the observer target into documentElement and condition to watch the title & body changes when the entry target is head or HTML, then body children.

Accudio commented 1 year ago

Fixed in v0.4.1! Thanks!