Skip to content

Commit

Permalink
[BACKPORT]: Frame navigations push state
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpdoyle committed Dec 10, 2021
1 parent 80a630e commit fd64bb8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,14 @@ addEventListener("click", ({ target }) => {
}
}
}, { passive: true })

addEventListener("turbo:frame-load", ({ target }) => {
const action = target.getAttribute("data-turbo-action")
const state = [ {}, "", target.src ]

if (action == "advance") {
history.pushState(...state)
} else if (action == "replace") {
history.replaceState(...state)
}
})

0 comments on commit fd64bb8

Please sign in to comment.