Skip to content

Commit

Permalink
fix(database): support multiple queries on the same reference
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancarriger authored and Dave Gööck committed Aug 3, 2018
1 parent 93612a5 commit bb36329
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/database/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,11 @@ export class AngularFireOfflineDatabase {
query: { }
};

// Get latest set of options
const optionsLength = this.listCache[key].options.length;
const latestOptions = this.listCache[key].options[optionsLength - 1];
if (latestOptions.query) { newOptions.query = latestOptions.query; }
if (this.listCache[key].options.length === 1) {
newOptions.query = this.listCache[key].options[0].query;
} else {
// Get the entire list, run query locally
}

this.listCache[key].firebaseOptions = newOptions;
return JSON.stringify(initialOptions) !== JSON.stringify(newOptions);
Expand Down

0 comments on commit bb36329

Please sign in to comment.