Skip to content

Conversation

@CPatchane
Copy link
Contributor

@CPatchane CPatchane commented May 30, 2023

Based on the code source https://github.com/rails/rails/blob/main/actionview/app/assets/javascripts/rails-ujs.js

This is not compatible with jquery-ujs since the custom event (like ajax:success) listeners signature are changing from jquery-ujs to rails-ujs:

  • jQueryUJS, by using .trigger() from jQuery, makes the listener signature looking like onSuccess(event: Event, data: any) => { console.log(data) }
  • in contrast, RailsUJS missing jQuery, is now using the native Event API with .dispatchEvent() and a CustomEvent making the listener looking like onSuccess(event: CustomEvent<any>) => { console.log(event.detail) }

jquery-ujs source
rails-ujs source

@CPatchane CPatchane requested review from lou and tesnouf-drivy May 30, 2023 16:59
@CPatchane CPatchane self-assigned this May 30, 2023
@CPatchane CPatchane force-pushed the fix/allow_railsUJS_events branch from b65c44c to 205de55 Compare May 30, 2023 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant