Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
fix(database): support multiple queries on the same reference
Browse files Browse the repository at this point in the history
related: #9
  • Loading branch information
adriancarriger committed May 22, 2017
1 parent ff2599a commit addb0f3
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 addb0f3

Please sign in to comment.