I’m trying to debug some baffling behaviour in Turbo 7.0.1 on {Safari Tech Preview 134, Firefox 94.0.1, Chrome 95.0.4638.69), running on Intel macOS Monterey:
The turbo:load
event isn’t triggered on an application visit.
The code on the target page is simple:
document.addEventListener('turbo:load', function() {
console.log('loading now');
});
Turbo seems to be working fine: I’m bundling it via rollup and loading it using
import * as Turbo from '@hotwired/turbo';
When I click links I see Turbo intercepting the click and loading pages etc:
perform [turbo.es2017-esm.js:353:35](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) issueRequest [turbo.es2017-esm.js:1380:25](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) visitStarted [turbo.es2017-esm.js:1607:14](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) start [turbo.es2017-esm.js:1337:25](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) startVisit [turbo.es2017-esm.js:1942:26](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) visitProposedToLocation [turbo.es2017-esm.js:1604:23](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) visitProposedToLocation [turbo.es2017-esm.js:2515:21](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) proposeVisit [turbo.es2017-esm.js:1936:26](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) visit[turbo.es2017-esm.js:2452:23](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) followedLinkToLocation [turbo.es2017-esm.js:2493:70](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js)LinkClickObserver/this.clickBubbled [turbo.es2017-esm.js:1888:38](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) (Async: EventListener.handleEvent)LinkClickObserver/this.clickCaptured [turbo.es2017-esm.js:1878:29](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) (Async: EventListener.handleEvent) start[turbo.es2017-esm.js:1897:29](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) start [turbo.es2017-esm.js:2422:35](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) start [turbo.es2017-esm.js:2656:12](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js) <anonymous>[turbo.es2017-esm.js:3153](http://127.0.0.1:5000/node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js)
But my turbo:load
: event isn’t triggered, no matter what I do. Hard-refreshing the destination page does trigger the event, though (as expected?), so I know it’s not some elementary JS error. Other turbo events are also failing to trigger, not just load
.
Can anyone shed some light on why this doesn’t work?