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
db.type() impredictible behavior regression (5.2.0) #4788
Comments
Interesting bug! Seems to be due to removing Presumably we need to add it back to |
Should .type() be deprecated in favour of .info()? |
@nolanlawson Thanks for reviewing. I can't express how much I love you guys for maintaining PouchDB, thanks a lot, really! |
@NickColley It's basically undocumented; it's one of those weird edge cases where it's widely used by plugins (naughty me), but probably should not exist or should be made official. |
I can't reproduce the issue in
pouchdb/tests/integration/test.basics.js Lines 1041 to 1044 in b933b98
I don't get the async chicken and egg story with Your call. |
@bbenezech I can reproduce your issue in the browser using the code you provided above. That code would be perfectly fine for a unit test; in fact you can simplify by it by using the same db name for both PouchDB objects and using the new PouchDB(dbs.name).type().should.be.a('function');
new PouchDB(dbs.name).type().should.be.a('function'); I'm going to mark this as a good first patch, because it seems like it should be pretty easy to solve. I don't know why re-adding the old |
To fix this bug:
|
Ok, I can reproduce with new PouchDB(dbs.name).type.should.be.a('function') // works (leveldb)
new PouchDB(dbs.name, { adapter: 'idb' }).type.should.be.a('function') // fails
new PouchDB(dbs.name, { adapter: 'websql' }).type.should.be.a('function') // fails @nolanlawson How can I test this cleanly? |
@bbenezech if you follow @nolanlawson's guide then it looks like that test should fail in the browser (without needing |
Fixed in 7f2321b |
Tested in latest chrome:
With PouchDB 5.2.0
A setTimeout to display
db2.type()
(sometime 0, sometime more) fixes it.It worked as expected with 5.1.0
Tell me how I can help.
The text was updated successfully, but these errors were encountered: