GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Event handlers are executed multiply times
fixed Turbolinks delegates click multiply times
I was having the same problem and this fix worked for me.
I guess #145 could solve turbolinks issues. Could you please test it?
@lest, this commit does fix my problem of multiple events firing
gem 'nested_form', ref: '0607c80', git: 'https://github.com/fxposter/nested_form.git'
Also, i'm seeing nested:fieldAdded firing properly in 0607c80 which wasn't happening in either of these commits
gem 'nested_form', '0.3.1'
gem 'nested_form', '0.3.1', git: 'https://github.com/leoniddinershtein/nested_form.git'
Is there a more recent commit that I should be using / testing against?
FWIW, my app also uses simple_form, client_side_validations, backbone, bootstrap (desktop), and jquery_mobile (mobile). I use nested_form on both desktop and mobile.
@ccmcbeck Thanks for testing <3
I'm going to rebase #145 and push it to the master branch.
Thanks to you for working this issue. If you need additional assistance, just let me know.
@ccmcbeck I've pushed jquery code changes from #145 to the master branch of nested_form. Could you please confirm that it's working with turbolinks now?
@lest, when i use this
gem 'nested_form', branch: 'master', git: 'https://github.com/ryanb/nested_form.git'
The edit and delete UJS actions work fine, however only the nested:fieldAdded fires
When I revert back to
Both events fire. I checked it in the Safari Web Inspector timeline and with this code:
$(document).on 'nested:fieldAdded', ->
$(document).on 'nested:fieldRemoved', ->
@ccmcbeck Weird... I'll try to test it and provide a fix. It'll be very helpful to have a test application reproducing this issue.
It is weird. I will look into it further and isolate the code to see if it's my error.
I am having this issue as well, guess turbolinks can wait. Everytime I use them sooner or later run into one issue or another.
+1, also just realized that turbo-links was causing the link_to_add event to fire multiple times.
@ndbroadbent Any ideas about the best solution for adding event handlers and being compatible with turbolinks?
@lest, I looked into this a little further, and figured out how to make it work. We've got to follow the advice given in the "Evaluating script tags" section of the turbolinks README.
Closing as it seems there is no need to make any changes to nested_form.