Skip to content

Skippable instead of One and Done #1273

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

Merged
merged 1 commit into from
Jul 28, 2025
Merged

Skippable instead of One and Done #1273

merged 1 commit into from
Jul 28, 2025

Conversation

rjrjr
Copy link
Contributor

@rjrjr rjrjr commented Jul 25, 2025

The One and Done entry was bad advice, or at least incomplete. Updated to describe the Skippable Workflow pattern we've been using with a lot of success lately.

Perhaps it's a simple boolean function indicating whether or not the child actually has any work to do:

```kotlin
state = if (stepTwoWorkflow.isThisNecessary()) RunStepTwo else RunStepThree
Copy link

Choose a reason for hiding this comment

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

This only works if the stepTwoWorkflow is created and stored in the state a head of time, before you get to the apply(action) method. If your stepTwoWorkflow can't be created until you get into the apply(action) with a specific action/state, then you are out of luck.

Copy link
Contributor Author

@rjrjr rjrjr Jul 25, 2025

Choose a reason for hiding this comment

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

Typically in Kotlin child workflows are DI injected (available as constructor parameters of the parent), and actions are inner objects of the parent workflow with access to its injected dependencies.

In Swift, didn't a change just land to make the parent workflow available from the action? cc @jamieQ

@rjrjr rjrjr requested a review from steve-the-edwards July 25, 2025 20:19
The One and Done entry was bad advice, or at least incomplete. Updated to describe the Skippable Workflow pattern we've been using with a lot of success lately.
@rjrjr rjrjr merged commit 3a799fd into main Jul 28, 2025
3 checks passed
@rjrjr rjrjr deleted the ray/skippable branch July 28, 2025 20:29
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.

3 participants