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

Put in checks for dispatch-sync #42

Closed
mike-thompson-day8 opened this issue Apr 4, 2015 · 2 comments
Closed

Put in checks for dispatch-sync #42

mike-thompson-day8 opened this issue Apr 4, 2015 · 2 comments

Comments

@mike-thompson-day8
Copy link
Contributor

dispatch-sync can't be called from within an event handler - only an async dispatch can be "called".

Warn if this is ever attempted.

Why is it a problem? Well the the first event handler is given a snapshot of the db as a parameter. And whatever this first event handler returns will be put back into app-db when it finishes. So any changes made by an intermediate call to dispatch-sync will be lost.

So the problem sequence would be:

  1. first event handler called with db snapshot
  2. dispatch-sync called, making changes to app-db
  3. first event handler finishes, and its returned db is written into app-db

Ie. the changes in step 2 are lost. (no longer in app-db)

@mike-thompson-day8
Copy link
Contributor Author

mike-thompson-day8 added a commit that referenced this issue Apr 21, 2015
@mike-thompson-day8
Copy link
Contributor Author

New error added. Will be a part of v0.3.2

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