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

Question about the safety of the "entries" method #169

Open
fabiospampinato opened this issue Sep 6, 2023 · 0 comments
Open

Question about the safety of the "entries" method #169

fabiospampinato opened this issue Sep 6, 2023 · 0 comments

Comments

@fabiospampinato
Copy link

fabiospampinato commented Sep 6, 2023

I see the entries method basically requests both keys and values and then merges them together:

return Promise.all([
    promisifyRequest(store.getAllKeys()),
    promisifyRequest(store.getAll()),
]).then(([keys, values]) => keys.map((key, i) => [key, values[i]]));

This looks potentially problematic to me, but I don't know enough about IndexedDB to be sure, hence the question: can this ever return an incorrect result? Like is it possible that after the key for an object is returned, but before the value for that object is returned, the key gets deleted so that one ends up with the array of keys and the array of values having different lengths, which would potentially completely mess up the database depending on how those entires are manipulated?

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

No branches or pull requests

1 participant