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

Remove all_perform callbacks #365

Closed
wants to merge 4 commits into from

Conversation

mjonas87
Copy link
Contributor

Description

When I introduced the all_perform callbacks for Organizers, it didn't occur to me that the perform callbacks already do the same thing (since an Organizer is an Interactor).

The only problem with that was a dependency I introduced for running deferred after_perform callbacks that ran these based on the all_perform callbacks. I moved this logic to run after the perform callbacks and everything seems to be working as expected.

I also updated some of the specs so that they're a bit easier to read and update.

Information

  • Contains Documentation
  • Contains Tests
  • Contains Breaking Changes

Related Issues

none

TODO

none

Changelog

Removed

  • all_perform callback for Organizers. Please use the perform callbacks instead.

With a slight adjustment to when we run the deferred after_perform callbacks, we can achieve the same ordering by using after_perform as we had with after_all_perform.
These turned out to be redundant since Organizer already implements 'perform' callbacks. I had to where the deferred callbacks get run so that the timing is the same when using after_perform as it was for all_perform.
@mjonas87
Copy link
Contributor Author

mjonas87 commented Sep 20, 2023

@aaronmallen Only took me a year to realize this part isn't necessary 😅. This PR removes those callbacks entirely...I figure it's easy to swap out after_all_perform with after_perform, but let me know if you'd prefer a soft deprecation first.

@aaronmallen
Copy link
Owner

I'm working on a breaking change for this gem and this is a breaking change itself. I think for 1.x we're going to leave this functionality in, redundant or not. I appreciate the correction though!

@aaronmallen aaronmallen added the wontfix This will not be worked on label Sep 21, 2023

if context&.success? && interactor.respond_to?(:run_after_perform_callbacks_on_children)
interactor.run_after_perform_callbacks_on_children
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronmallen if I leave the callbacks in are you okay with a PR that includes just this change to move where the deferred callbacks get executed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants