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

[#9] Add support for atomic updates with Mutekt models #14

Merged
merged 7 commits into from
Sep 10, 2022

Conversation

PatilShreyas
Copy link
Owner

@PatilShreyas PatilShreyas commented Sep 8, 2022

Summary

For example: If the following is a model

@GenerateMutableModel
interface NotesState {
  val loading: Boolean
  val notes: List<String>
  val error: String?
}

Then, atomic update will be possible with update{} method:

val notesState = MutableNotesState(...)

notesState.update {
  loading = false
  notes = listOf("Lorem Ipsum")
}

Here, on mutating loading and notes field of a state, only a a single value will be emitted as a state without affecting the current coroutine dispatcher.

  • Added interfaces MutektState and MutektMutableState. Mutable model implements it.

@PatilShreyas PatilShreyas marked this pull request as ready for review September 8, 2022 16:13
@PatilShreyas PatilShreyas changed the base branch from main to v1.0.0-alpha03-dev September 10, 2022 06:04
@PatilShreyas PatilShreyas merged commit 8b5e5af into v1.0.0-alpha03-dev Sep 10, 2022
@PatilShreyas PatilShreyas deleted the #9-atomic-update branch January 14, 2023 09:01
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.

How do you do atomic update with this ?
1 participant