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

Deleting multiple tables in a new version using null #1418

Closed
lajuffermans opened this issue Oct 27, 2021 · 1 comment · Fixed by #1419
Closed

Deleting multiple tables in a new version using null #1418

lajuffermans opened this issue Oct 27, 2021 · 1 comment · Fixed by #1419

Comments

@lajuffermans
Copy link

My starting point is something like this:

var db = new Dexie("bla");

db.version(1).stores({
    a: '++',
    b: '++',
    c: '++',
    d: '++',
    e: '++'
});

....in my new version I want to delete a, b, c and d so I add this:

db.version(2).stores({
    a: null,
    b: null,
    c: null,
    d: null,
    e: '++'
});

Only a and c are deleted, it looks like only the odd (or even?) tables are deleted when trying to delete multiple tables this way. 🤔

The behaviour is the same if I even add more tables. Is this a bug or am I doing something wrong here?

dfahlander added a commit that referenced this issue Oct 27, 2021
dfahlander added a commit that referenced this issue Oct 27, 2021
@dfahlander
Copy link
Collaborator

Thanks! The issue was a loop that read from the same objectStoreNames collection as was mutated by the deletion - so after deleting first object store, it went on to index 1, but the one on index 0 had shifted out so it jumped over it.

Resolved in PR #1419.

dfahlander added a commit that referenced this issue Oct 27, 2021
* Repro of issue #1418

* Resolves #1418

* Opting out the new test when addons are active
or where we have a workaround for buggy browser to not delete stores
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

Successfully merging a pull request may close this issue.

2 participants