Skip to content

Fix dual call issue with interactors with deferred after_performs#6

Merged
mjonas87 merged 1 commit intoforked-mainfrom
fix-dual-call-issue
Mar 28, 2024
Merged

Fix dual call issue with interactors with deferred after_performs#6
mjonas87 merged 1 commit intoforked-mainfrom
fix-dual-call-issue

Conversation

@mjonas87
Copy link

@mjonas87 mjonas87 commented Mar 26, 2024

Description

Fix dual call issue with interactors with deferred after_performs

If an Interactor that has deferred after_performs is called from an Organizer and then...later...directly, the after_performs are skipped when calling directly.

This is due to how Organizers handle Interactors with deferred logic. In such a case, the Organizer modifies the Interactor's callback so that it is skipped. However, this does not account for cases where an Interactor is called both as part of an Organizer and on it's own. In this case, the Interactor believes it should skip handling the after_performs forever, and rely instead on the Organizer to call them at the appropriate time.

This change updates the logic so that the callback is only skipped if the organizer property is not present. This property is used to tell the Interactor that and by what it is being "organized".

Information

  • [ ] Contains Documentation
  • Contains Tests
  • [ ] Contains Breaking Changes

Fixed

  • Issue where calling Interactor with deferred after_callbacks as part of an Organizer, and then later on its own...results in the after_perform callbacks being skipped the second time.

@mjonas87 mjonas87 requested a review from ChadGo March 26, 2024 07:13
Copy link

@Jordan-Templeman Jordan-Templeman left a comment

Choose a reason for hiding this comment

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

🚀

The only thing I am noticing is there may need to be a newline here but I can not check into this branch so I can not confirm
Screen Shot 2024-03-26 at 5 00 04 PM

Copy link

@Tristan-Trainual Tristan-Trainual left a comment

Choose a reason for hiding this comment

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

Couldn't find anything, just minor line space.

@mjonas87 mjonas87 force-pushed the fix-dual-call-issue branch from 1151baf to 69b8be6 Compare March 27, 2024 16:20
If an Interactor that has deferred after_performs is called from an Organizer and then...later...directly, the after_performs are skipped when calling directly.

This is due to how Organizers handle Interactors with deferred logic. In such a case, the Organizer modifies the Interactor's callback so that it is skipped. However, this does not account for cases where an Interactor is called both as part of an Organizer and on it's own. In this case, the Interactor believes it should skip handling the after_performs forever, and rely instead on the Organizer to call them at the appropriate time.

This change updates the logic so that the callback is only skipped if the organizer property is not present. This property is used to tell the Interactor that and by what it is being "organized".
@mjonas87 mjonas87 force-pushed the fix-dual-call-issue branch from 69b8be6 to cb5bc7f Compare March 28, 2024 01:09
Copy link

@jd-gray jd-gray left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@mjonas87 mjonas87 merged commit 365e1ae into forked-main Mar 28, 2024
@mjonas87 mjonas87 deleted the fix-dual-call-issue branch March 28, 2024 20: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.

4 participants