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

Allow chain-able/async emitChange or bulk change #66

Open
MaurizioVacca opened this issue Mar 19, 2021 · 0 comments
Open

Allow chain-able/async emitChange or bulk change #66

MaurizioVacca opened this issue Mar 19, 2021 · 0 comments

Comments

@MaurizioVacca
Copy link
Contributor

MaurizioVacca commented Mar 19, 2021

At the current state, if you use emitChange to update the form state in quick succession, the updates enter a race condition where the last called wins. For example, given the following scenario:

emitChange('name', value);
emitChange('surname', value);

the second emitChange will override the first one, so name will be accidentally restored to the original value instead of being updated.

Possible solutions may be:

  • allow to consume emit* as a chain-able/async resource, e.g. await emitChange(fieldName, value);
  • add a "bulk update" emitter that can take a part of the form as a resource, e.g. emitBulkUpdate({key_1: value, key_2: value});
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

No branches or pull requests

1 participant