lib/assets/javascripts/unpoly/classes/follow_variant.coffee in unpoly-rails-0.60.0 vs lib/assets/javascripts/unpoly/classes/follow_variant.coffee in unpoly-rails-0.60.1
- old
+ new
@@ -44,10 +44,13 @@
promise = up.event.whenEmitted('up:link:follow', log: 'Following link', target: link)
promise = promise.then =>
up.feedback.start(link) unless options.preload
@followNow(link, options)
unless options.preload
- promise = promise.then -> up.feedback.stop(link)
+ # Make sure we always remove .up-active, even if the follow fails or the user
+ # does not confirm an [up-confirm] link. However, don't re-assign promise
+ # to the result of up.always() since that would change the state of promise.
+ u.always promise, -> up.feedback.stop(link)
promise
matchesLink: (link) =>
e.matches(link, @fullSelector())