Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Transaction block not immediately called in Dexie 1.4.1 #268
Dexie 1.4.1 is breaking my current code because it handles transaction calls differently than 1.3.6.
Dexie 1.3.6 output:
Dexie 1.4.1 output:
Is this changed behavior intended, I can not find anything in the documentation about it?
In 1.3.6 it could vary whether you would get 3,1,2 or 1,3,2 depending on whether database was finished opening, a parent transaction was locked, or not. But in most normal cases, it would be 1.3.2. Now it will always be 3,1,2. The expected order was never documented and the new order is not documented either, even though it should be.
I'm sorry this breaks your code. Is it possible to work around?
There is a reason for this change and it has to do with preventing transaction from aborting prematurely. In 1.3.6 and earlier, I had to do lots of unpleasant workarounds to keep the transaction alive. I couldn't chain promises normally which resulted in hard-to-understand code. In version 1.4+, transaction blocks always begin with Promise.resolve().then(..), which results in the 3,1,2 sequence. By doing that, I can kick-in a virtual micro-tick engine that makes sure to never let the transaction slip away between then().. calls.
Hope this explains it. Also hope you can find a way to work around the issues you get from this change.