so I am using cocoon and stimulus with latest version on rails. In the controller js file, event listener for turbolinks:before-cache gets triggered but event listeners related to cocoon are not getting triggered.
Here is the code:
document.addEventListener(“turbolinks:before-cache”, () => {
console.log(‘turbolinks:before-cache’)
}, {once: true})document.addEventListener("cocoon:after-insert", () => { console.log('cocoon:after-insert') })
document.addEventListener(“cocoon:after-remove”, () => {
console.log(‘cocoon:after-remove’)
})
I see only turbolinks:before-cache in the console log.