Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting if turbo:load event was caused by a refresh #1150

Open
pfeiffer opened this issue Jan 31, 2024 · 0 comments
Open

Detecting if turbo:load event was caused by a refresh #1150

pfeiffer opened this issue Jan 31, 2024 · 0 comments

Comments

@pfeiffer
Copy link
Contributor

We're testing out the new Turbo 8 refresh feature, which is a great new addition!

One issue we're facing is that we have quite a few Stimulus controllers which react to eg. turbo:load events and we'd like to be able to differentiate between a refresh (eg. which triggered via a Turbo stream) and a normal visit triggered by a user action.

An example could be an analytics controller which tracks page views like <body .. data-action="turbo:load@window->analytics#trackPageView">. When a page is refreshed and morphed, we do not want to track a page view, as the action was not triggered by a user interaction.

Inspecting the event details received in turbo:load doesn't really provide is any granularity about the visit that triggered that action.

Any ideas or suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant