Skip to content

Instantly share code, notes, and snippets.

@mcatta
Last active October 25, 2022 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcatta/48c638d81db841ae181bd5352d525ceb to your computer and use it in GitHub Desktop.
Save mcatta/48c638d81db841ae181bd5352d525ceb to your computer and use it in GitHub Desktop.
spec {
// ContentState
inState<GithubState.ContentState> {
on { action: GithubAction.TypeOwner, state: State<GithubState.ContentState> ->
state.mutate { copy(owner = action.input) }
}
on { _: GithubAction.Confirm, state: State<GithubState.ContentState> ->
val owner = state.snapshot.owner
if (owner.isNotBlank()) {
state.override { GithubState.Load(owner = owner) }
} else {
state.noChange()
}
}
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment