Turbolinks compatibility

I’m trying to integrate plotly.js in my rails 5 project.
I’m at a point that it works really well for the first page load, but it doesn’t work for other visits except in the case of a full reload. It seems the UI goes under the graph instead of over it.

Is there something I need to do or is plotly js not compatible with Turbolinks 5.1

Here’s the code.

document.addEventListener("turbolinks:before-cache", ->

#purge plot so it doesn’t go in cache
if ($("#graph-tester").length == 1)
Plotly.purge(‘graph-tester’)
)

document.addEventListener(“turbolinks:load”, ->
if ($("#graph-tester").length == 1)
#TESTER = document.getElementById(‘graph-tester’)
plotTest = Plotly.newPlot( ‘graph-tester’, plotlyData, plotlyLayout, {
scrollZoom: false,
displaylogo: false,
showLink: true
#displayModeBar: false
} )

Thank you

Hey, we’re having the same issue with Turbolinks 5 and plotly.js. Did you ever find a way to make them play nicely?

Sorry, I just made the pages that use those not use turbolinks.

Really not the best solution, but it works at least.