Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent double requests from within
turbo-frame
Closes hotwired#743 The change in behavior can be traced back to [hotwired#412][]. When the overlap between the `LinkInterceptor` and the `LinkClickObserver` were unified, the technique used by the `LinkInterceptor` to prevent duplicate event handlers from responding to the same `click` event was changed in a subtle way. In its place, this commit changes the `LinkClickObserver` to monopolize its handling of `click` events on `<a>` elements that navigate the page or drive `<turbo-frame>` elements. In tandem with the existing call to [Event.preventDefault][], this commit adds a call to [Event.stopImmediatePropagation][]. To exercise this edge case, this commit also adds a `ujs.html` fixture file along with a `ujs_tests.ts` module to cover situations when `@rails/ujs` and `@hotwired/turbo` co-exist. [hotwired#412]: hotwired#412 [Event.preventDefault]: https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault [Event.stopImmediatePropagation]: https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation
- Loading branch information