You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
varschemaBuilder=lf.schema.create('todo',1);schemaBuilder.createTable('Item').addColumn('id',lf.Type.INTEGER).addColumn('name',lf.Type.STRING).addPrimaryKey(['id']);vardb;varitem;schemaBuilder.connect().then(function(database){db=database;item=db.getSchema().table('Item');varrows=[item.createRow({'id': 1,'name': 'foo'}),item.createRow({'id': 2,'name': 'bar'}),];returndb.insertOrReplace().into(item).values(rows).exec();}).then(function(){// case one// observe a query, observe callback would not be firedvarselectQuery=db.select().from(item);db.observe(selectQuery,function(changes){selectQuery.exec().then(values=>{console.log('just observe: ',values);});});}).then(function(){// case two// observe a query and exec the query// observe callback would be firedvarselectQuery=db.select().from(item);db.observe(selectQuery,function(changes){selectQuery.exec().then(values=>{console.log('empty results: ',values);});});// would triggle changesreturnselectQuery.exec();}).then(function(){// case three// observe a query and exec the query// but the results of the query is an empty array// observe callback would not be firedvarselectQuery=db.select().from(item).where(item.id.gt(2));db.observe(selectQuery,function(changes){selectQuery.exec().then(values=>{console.log('empty results: ',values);});});// would not triggle changesreturnselectQuery.exec().then(results=>{console.log('empty: ',results)})})
in #209 , observe callback is fired after update or delete query.
my problem is, in the case2 :
db.observe(query,callback)query.exec()
observe callback is fired by query.exec(), is this a expected behavior?
the difference between #209 and this case is, nothing updated after the query was observed, but the callback is fired.
chuan6
pushed a commit
to ReactiveDB/core
that referenced
this issue
Jul 26, 2017
Code to reproduce:
see: https://jsfiddle.net/6t3fofwm/11/
I'm confused which case is working as expected.
The text was updated successfully, but these errors were encountered: