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

feat: 🎸 state transactions #99

Merged
merged 5 commits into from
Feb 3, 2021
Merged

feat: 🎸 state transactions #99

merged 5 commits into from
Feb 3, 2021

Conversation

VojtaSim
Copy link
Contributor

Ability to queue state patches and then commit them as a one to the
original state.

For use cases where you'd in you workflow call setState method multiple times or you'd have to collect state patches in a separate variable (this is hard to do across multiple methods).

  1. Transaction is initiated with beginTransaction() method (or beginStateTransaction() in Controller/Extension).
  2. From now on every setState call is queued and doesn't change the state or re-render anything.
  3. Queue is applied with commitTransaction()/commitStateTransaction() method or emptied with cancelTransaction()/cancelStateTransaction() method.

Simko, Vojtech added 5 commits January 28, 2021 09:28
Ability to queue state patches and then commit them as a one to the
original state.
Transaction commit includes only queued patches without the original
state.
Current patch queue is included in a warning before the queue is erased.
Added documentation for state transactions
Final patch is generated by using apply fn on Object.assign insted of
reduce.
@mjancarik mjancarik merged commit ad6237e into master Feb 3, 2021
@mjancarik mjancarik deleted the state-transactions branch July 14, 2022 13:44
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.

2 participants