Reputation: 427
I make changes to the database and try to read updated data, but I get old one with the code below:
kera.db.transaction('rw', kera.db.settings, async () => {
await kera.db.settings.where('name').equals('background')
.modify({[setting]: value});
await kera.db.settings.get('background', (data) => {
console.log(data);
});
});
If I call the same get() function later, I get the updated data this time.
Upvotes: 0
Views: 300
Reputation: 5691
I think there might be something else in the code that fails. Try catching rejected promise of the transaction and see if you got something failing. Also verify that the closure variable setting is correct and that value is correct. By the example, you assume your primary key is name
. If that's not the case, you'd need to change from db.settings.get('background') to db.settings.get({name: 'background'}). I've tried to repro the issue but it works for me:
Upvotes: 1