File tree 2 files changed +18
-4
lines changed 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -449,9 +449,6 @@ export class SyncEngine implements RemoteSyncer {
449
449
450
450
return (
451
451
this . loadBundleAsync ( bundleReader , task )
452
- // TODO(wuandy): Loading a bundle will fail the entire SDK if there is
453
- // an error. We really should have a way to run operations on async queue
454
- // and not failing the rest if there is an error.
455
452
. catch ( reason => {
456
453
task . failedWith ( reason ) ;
457
454
} )
Original file line number Diff line number Diff line change @@ -226,14 +226,31 @@ apiDescribe('Bundles', (persistence: boolean) => {
226
226
227
227
it ( 'load with documents from other projects fails.' , ( ) => {
228
228
return withTestDb ( persistence , async db => {
229
- const builder = bundleWithTestDocs ( db ) ;
229
+ let builder = bundleWithTestDocs ( db ) ;
230
230
return withAlternateTestDb ( persistence , async otherDb => {
231
231
// eslint-disable-next-line @typescript-eslint/no-floating-promises
232
232
expect (
233
233
otherDb . loadBundle (
234
234
builder . build ( 'test-bundle' , { seconds : 1001 , nanos : 9999 } )
235
235
)
236
236
) . to . be . rejectedWith ( 'Tried to deserialize key from different project' ) ;
237
+
238
+ // Verify otherDb still functions, despite loaded a problematic bundle.
239
+ builder = bundleWithTestDocs ( otherDb ) ;
240
+ const progress = await otherDb . loadBundle (
241
+ builder . build ( 'test-bundle' , { seconds : 1001 , nanos : 9999 } )
242
+ ) ;
243
+ verifySuccessProgress ( progress ) ;
244
+
245
+ // Read from cache. These documents do not exist in backend, so they can
246
+ // only be read from cache.
247
+ const snap = await otherDb
248
+ . collection ( 'coll-1' )
249
+ . get ( { source : 'cache' } ) ;
250
+ expect ( toDataArray ( snap ) ) . to . deep . equal ( [
251
+ { k : 'a' , bar : 1 } ,
252
+ { k : 'b' , bar : 2 }
253
+ ] ) ;
237
254
} ) ;
238
255
} ) ;
239
256
} ) ;
You can’t perform that action at this time.
0 commit comments