From bb363297550f05f5f89011e67ed732abd716e404 Mon Sep 17 00:00:00 2001 From: adriancarriger Date: Sun, 21 May 2017 19:19:17 -0500 Subject: [PATCH] fix(database): support multiple queries on the same reference related: #9 --- src/database/database.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/database/database.ts b/src/database/database.ts index 8ba872b..5adfa26 100644 --- a/src/database/database.ts +++ b/src/database/database.ts @@ -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);