Skip to content

Intermittent logouts with Symfony and Turbo/Stimulus #60247

Closed Answered by 3rd3
3rd3 asked this question in Q&A
Discussion options

You must be logged in to vote

Chrome's dev tools allowed me to figure this one out by inspecting the JS initiator of requests in the network tab. It turns out that Turbo tries to be smart about prefetching sites when hovering with the mouse over navigation links! So whenever the mouse touched the logout link, the session would be logged out.

One can disable it by adding a meta tag:

<meta name="turbo-prefetch" content="false">

or data attribute to/around the links:

<a href="/logout" data-turbo-prefetch="false">Logout</a>

<div data-turbo-prefetch="false">
  <a href="/logout">Logout</a>
</div>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 3rd3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant