Assets not loaded with turbo router (backend page)


I have a plugin and in the controller i load assest in index function like this “$this->addJs(‘/plugins/rinc/magento/assets/js/Chart.min.js’);”

in the first load of the page or F5 my js is loaded and all work fine, but when i click on the page menu and the page is loaded with turbo router, my js is not loaded i have have for example this error “Chartjs undefined”

is there something to do with turbo router ?


The script using ChartJs is loading before chartjs. Tell it to wait with the page:loaded event

addEventListener(‘page:loaded’, …);

Or even better, use hot controls to dispose the charts and save memory when leaving the page.