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

Request to implicitly create a new store with autoSchema is never triggered #87

Open
mehdirande opened this issue Nov 3, 2015 · 3 comments
Labels

Comments

@mehdirande
Copy link
Contributor

I have a very strange behaviour with autoSchema.
I might have miss something in the documentation or with this option usage but whenever I implicitly create a store (after the first one) by putting a value inside, the deferred request never end :

var db = new ydn.db.Storage('newDatabase', null, {autoSchema: true});
db.put('firstStore', {value: 'dummy'}, 1).always(function() { 
  console.log('Ok');
  return db.put('firstStore', {value: 'still dummy'}, 2);
}).always(function() {
  console.log('Still Ok');
  return db.put('secondStore', {value: 'Too much dummy'}, 1);
}).always(function() {
  console.log('Will not be displayed');
});

If I take a look at my indexed db, secondStore is created but empty.
Even strager, if I add

db.put('firstStore', {value: 'no more dummy please'}, 3);

or

db.put('secondStore', {value: 'no more dummy please'}, 2);

The put in 'secondStore' is triggered and 'Will not be displayed' is printed.

Could you help me to find what i'm doing wrong ?

@mehdirande mehdirande changed the title Second store AutoSchema Request to implicitly create a new store with autoSchema is never triggered Nov 3, 2015
@yathit
Copy link
Owner

yathit commented Nov 3, 2015

I think you are doing right.

I never use autoSchema in my app, so do not test extensively. Auto schema, which is possible and easier to use, but require disconnect and reconnect the database connection. I can imagine some callback are lost during the process.

When I have time, I will create a unit test and fix it.

@yathit yathit added the bug label Nov 3, 2015
@mehdirande
Copy link
Contributor Author

Thanks a lot, first time i'm using this option too.

@cepm-nate
Copy link

@yathit are you still around? I'm curious if anyone's made progress on this?

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

3 participants