-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
Native async/await and upgrade handlers #612
Comments
Ok, I think the upgraders fail to reference count the db operations as standard promises take place instead of Dexie.Promise. Reference counting is not needed with async functions and we should really respect the returned promise instead. Could be easily fixed. |
Hi David, thanks for the reply, a fix would be great. |
I'll try fix it next week. Just a note for other readers : using native (non-transpiled) async await can only work well on recent versions of Chrome, Edge, opera and Safari. Firefox still has issues when involving native promises in an indexedDB transaction, and not all users have the latest versions of their browsers. Therefore, it is still recommended to transpile async/await code using either babel or typescript if it should work on most end users browsers. |
Calling upgrader the same way as it is done in transaction scope
Calling upgrader the same way as it is done in transaction scope
Calling upgrader the same way as it is done in transaction scope
Closing as it is now resolved in master branch and will be part of next 3.0.0-release. |
Hi, I'm currently trying to upgrade my codebase to native es2017 and especially native async/await. I am aware that I will have to to do some extra work to include Firefox. This is the story about Chrome. I'm using Dexie
2.0.1
and everything seems to work well so far. The only thing that does not work is migration with async callbacks. I prepared aJSFiddle
to illustrate this (This contains also a version with purethen
callbacks and a version involving generator functions both of witch work fine): https://fiddle.jshell.net/sechel/06gcbbpL/The console output illustrates that there is something strange going on.
It seems to me as if the async handlers are not called sequentially but somehow in parallel on the same transaction!? Does that make sense, am I missing something?
The text was updated successfully, but these errors were encountered: