domchristie / turn

📖 Animate page transitions in Turbo Drive apps
https://domchristie.github.io/turn/
MIT License
167 stars 6 forks source link

Do not run if current page is requested #4

Closed kylesloper closed 2 years ago

kylesloper commented 2 years ago

Totally believe this is personal choice but with heavy page transitions on load, disabling Turbo/Turn if the page requested is the current page is best for UX and helping the site feel more app-like.

Love the project <3

domchristie commented 2 years ago

Thanks @kylesloper! Nice observation. It certainly makes sense that a visit to the current location doesn't trigger an animation. Calling preventDefault on turbo:before-visit will cancel the visit entirely, which may not be the desired behaviour. For example, when a user wants to reload the current page by tapping a link, this will prevent them from doing so.

I'm considering an API for conditionally switching off animations, so I'll bear this in mind. Thanks again :)