Skip to content
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

BigInt64Array getting corrupted after an update #1890

Closed
michaelwallabi opened this issue Feb 1, 2024 · 5 comments
Closed

BigInt64Array getting corrupted after an update #1890

michaelwallabi opened this issue Feb 1, 2024 · 5 comments
Labels

Comments

@michaelwallabi
Copy link

Repro:

  • Create a table that contains a BigInt64Array nested within another object
  • Store a record
  • Update a field in the record

Expected:

  • only the updated field has changed

Actual:

  • The BigInt64Array is converted to an object after the update. It goes from BigInt64Array[1n,2n] to { 0: 1n, 1: 2n }.

https://jsitor.com/Pb5sqDxM9p

Sample code

const db = new Dexie("usingbigint");
db.version(1).stores({
  obj: 'id',
});

Promise.resolve().then(async ()=>{
  await db.obj.put({id: 1, updated: Date.now(), cols: [{values: new BigInt64Array([1n,2n])}]});
  console.log((await db.obj.get(1)));
  await db.obj.update(1, {
    updated: Date.now()
  });
  console.log((await db.obj.get(1)));
}).catch(console.error);
@dfahlander
Copy link
Collaborator

Are you using dexie3 or 4? I can't open the jsitor link.

@michaelwallabi
Copy link
Author

Thanks for taking a look @dfahlander. I'm using 3.2.4. Here's a jsfiddle with the repro as well:

https://jsfiddle.net/erpcwaz2/

@dfahlander dfahlander added the bug label Feb 1, 2024
@dfahlander
Copy link
Collaborator

Thanks a lot!

dfahlander added a commit that referenced this issue Feb 1, 2024
dfahlander added a commit that referenced this issue Feb 1, 2024
dfahlander added a commit that referenced this issue Feb 5, 2024
@michaelwallabi
Copy link
Author

@dfahlander I saw you fixed/merged this into the 4.x code line, thank you! Any chance you're going to release a 3.x version with this change?

dfahlander added a commit that referenced this issue Feb 8, 2024
@michaelwallabi
Copy link
Author

Thanks @dfahlander. Testing with 3.2.5 and all looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants