Skip to content

Commit

Permalink
wrap afterEach in requestAnimationFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed Feb 1, 2024
1 parent 58accac commit 8e89aca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/js/phoenix_live_view/live_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,10 @@ export default class LiveSocket {

// must be called after a navigation was performed, see `withNavigationGuard`.
afterNavigation(to, from){
this.navigationCallbacks["afterEach"](to, from)
// wait for the DOM to be patched
window.requestAnimationFrame(() => {
this.navigationCallbacks["afterEach"](to, from)
})
}

bindForms(){
Expand Down

0 comments on commit 8e89aca

Please sign in to comment.