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
Update with array as value adds number objects #1195
Comments
Tried to reproduce in https://jsitor.com/DGNaFfv5S but it seems to behave as it should. const db = new Dexie("bubbu");
db.version(1).stores({
books: 'id'
});
Promise.resolve().then(async ()=>{
await db.books.put({id: 1});
console.log (JSON.stringify(await db.books.get(1)));
const field = 'authors'
await db.books.update(1, {
[field]: [{ foo: 'bar' }, { foo2: 'bar2' }]
});
console.log(JSON.stringify(await db.books.get(1)));
}).catch(console.error); Output:
|
Thanks for confirming that's not it. I figured out it came from the updating hook: https://jsitor.com/32Nht9kOY The modifications are saved to the cache as |
Ok! The array is somehow interpreted as an object. I will investigate this. There was a similar issue and PR recently #1130. I also notice that the behavior between using dexie 2.x and 3.x. |
…nd never go into them to treat array indices as if they were object props. Resolves #1195.
…nd never go into them to treat array indices as if they were object props. Resolves #1195.
I might be completely missing something but this is odd behavior to me:
This ends up with
authors.0
andauthors.1
but it should just be an array.What's going on here?
The text was updated successfully, but these errors were encountered: