KonnorRogers / mrujs

UJS for modern javascript.
https://mrujs.netlify.app
MIT License
164 stars 16 forks source link

Emit "ujs:afterMorph" event after applying a page morph #210

Closed Matt-Yorkley closed 1 year ago

Matt-Yorkley commented 1 year ago

Status

Related Issue(s)

-

Additional Notes

I ran into a case where I was trying to apply some logic after page transitions where the user's session might have changed, and I hit this issue where 95% of the time I could hook into "turbo:load" events but 5% of the time (and depending on which page the user was on, and what the controller response was doing) the session change resulted in mrujs doing a page morph buuuuut there's no events that gets fired when that happens so there's nothing to listen for. So an event here would be really helpful.

I wasn't sure about the naming; it somewhat breaks from the convention of "ajax:<eventname>", but it feels like this event announcing an mrujs/morphdom update isn't related to ajax? As always, naming things is hard :man_shrugging:

netlify[bot] commented 1 year ago

Deploy Preview for mrujs canceled.

Name Link
Latest commit 538bfb227b64e23b4bf95998bf34a39f8b785ab4
Latest deploy log https://app.netlify.com/sites/mrujs/deploys/646fb0fa97d1300008b57ffd