Since shouldDelay true makes it use window.location.href (but the normal VE handler is not suppressed since this is not pre-edit), it will start loading the normal same-page VE way, then change pages anyway.
This can be fixed by just setting shouldDelay false if isViewPage is true, since in that case the event can fire in parallel with VE setting up, without an artificial timeout or href navigation.
This can be tested in Chromium:
- Put a breakpoint on the window.location.href line in logLinkClick.
- Check 'Preserve log' checked in the network panel.
- Click a VE edit link.
- Wait a bit, then let it proceed past the break.
With the bug, the network panel will show it loading VE resources before the HTML page load starts.