You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I run this exact code outside of a transaction it behaves properly, if I write it inside of a transaction, it behaves abnormally.
function addKey(key: string, name: string) {
db.get(key) // { test }
db.put(key, { name });
db.get(key) // { test2 }
}
db.transaction(async () => {
const exists = await db.ifNoExists(key, () => addKey(key, "test2")); // regardless if exists resolves to true or false, it is still changing name from test to test2.
}
The text was updated successfully, but these errors were encountered:
I can't reproduce this, with this code. It seems to properly call addKey when the entry for the key doesn't exist and doesn't call it when it does exist. Are you using the latest version? Do you have a more complete/reproducible case?
If I run this exact code outside of a transaction it behaves properly, if I write it inside of a transaction, it behaves abnormally.
function addKey(key: string, name: string) {
db.get(key) // { test }
db.put(key, { name });
db.get(key) // { test2 }
}
db.transaction(async () => {
const exists = await db.ifNoExists(key, () => addKey(key, "test2")); // regardless if exists resolves to true or false, it is still changing name from test to test2.
}
The text was updated successfully, but these errors were encountered: