Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script data-turbo-eval="false">
document.addEventListener('turbo:before-render', () => {
let permanents = document.querySelectorAll('[data-turbo-permanent]')
let undos = Array.from(permanents).map(el => {
el._x_ignore = true
return () => {
delete el._x_ignore
}
})
document.addEventListener('turbo:render', function handler() {
while(undos.length) undos.shift()()
document.removeEventListener('turbo:render', handler)
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment