@@ -184,6 +184,33 @@ describeSpec('Limits:', [], () => {
184
184
} ) ;
185
185
} ) ;
186
186
187
+ specTest (
188
+ 'Initial snapshots for limit queries are re-filled from cache' ,
189
+ [ ] ,
190
+ ( ) => {
191
+ // Verify that views for limit queries are re-filled even if the initial
192
+ // snapshot does not contain the requested number of results.
193
+ const fullQuery = Query . atPath ( path ( 'collection' ) ) . addFilter (
194
+ filter ( 'matches' , '==' , true )
195
+ ) ;
196
+ const limitQuery = Query . atPath ( path ( 'collection' ) )
197
+ . addFilter ( filter ( 'matches' , '==' , true ) )
198
+ . withLimit ( 2 ) ;
199
+ const doc1 = doc ( 'collection/a' , 1001 , { matches : true } ) ;
200
+ const doc2 = doc ( 'collection/b' , 1002 , { matches : true } ) ;
201
+ const doc3 = doc ( 'collection/c' , 1003 , { matches : true } ) ;
202
+ return spec ( )
203
+ . withGCEnabled ( false )
204
+ . userListens ( fullQuery )
205
+ . watchAcksFull ( fullQuery , 1003 , doc1 , doc2 , doc3 )
206
+ . expectEvents ( fullQuery , { added : [ doc1 , doc2 , doc3 ] } )
207
+ . userUnlistens ( fullQuery )
208
+ . userSets ( 'collection/a' , { matches : false } )
209
+ . userListens ( limitQuery )
210
+ . expectEvents ( limitQuery , { added : [ doc2 , doc3 ] , fromCache : true } ) ;
211
+ }
212
+ ) ;
213
+
187
214
specTest (
188
215
'Resumed limit queries exclude deleted documents ' ,
189
216
[ 'durable-persistence' ] ,
0 commit comments