File tree Expand file tree Collapse file tree 4 files changed +29
-4
lines changed Expand file tree Collapse file tree 4 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 1
- # Unreleased (firestore-api-changes)
1
+ # Unreleased
2
2
- [ changed] Removed the includeMetadataChanges property in FIRDocumentListenOptions
3
3
to avoid confusion with the factory method of the same name.
4
4
- [ changed] Added a commit method that takes no completion handler to FIRWriteBatch.
13
13
` true ` if the SDK loses its connection to the backend. A new event with
14
14
` snapshot.metadata.isFromCache ` set to false will be raised once the
15
15
connection is restored and the query is in sync with the backend again.
16
+ - [ fixed] Multiple offline mutations now properly reflected in retrieved
17
+ documents. Previously, only the last mutation would be visible. (#643 )
16
18
17
19
# v0.9.4
18
20
- [ changed] Firestore no longer has a direct dependency on FirebaseAuth.
Original file line number Diff line number Diff line change @@ -275,4 +275,27 @@ - (void)testQueriesFireFromCacheWhenOffline {
275
275
[registration remove ];
276
276
}
277
277
278
+ - (void )testCanHaveMultipleMutationsWhileOffline {
279
+ FIRCollectionReference *col = [self collectionRef ];
280
+
281
+ // set a few docs to known values
282
+ NSDictionary *initialDocs =
283
+ @{ @" doc1" : @{@" key1" : @" value1" },
284
+ @" doc2" : @{@" key2" : @" value2" } };
285
+ [self writeAllDocuments: initialDocs toCollection: col];
286
+
287
+ // go offline for the rest of this test
288
+ [self disableNetwork ];
289
+
290
+ // apply *multiple* mutations while offline
291
+ [[col documentWithPath: @" doc1" ] setData: @{@" key1b" : @" value1b" }];
292
+ [[col documentWithPath: @" doc2" ] setData: @{@" key2b" : @" value2b" }];
293
+
294
+ FIRQuerySnapshot *result = [self readDocumentSetForRef: col];
295
+ XCTAssertEqualObjects (FIRQuerySnapshotGetData (result), (@[
296
+ @{@" key1b" : @" value1b" },
297
+ @{@" key2b" : @" value2b" },
298
+ ]));
299
+ }
300
+
278
301
@end
Original file line number Diff line number Diff line change 18
18
19
19
#import < FirebaseCore/FIRLogger.h>
20
20
#import < FirebaseFirestore/FirebaseFirestore-umbrella.h>
21
- #import < Firestore/Source/Core/FSTFirestoreClient.h>
22
21
#import < GRPCClient/GRPCCall+ChannelArg.h>
23
22
#import < GRPCClient/GRPCCall+Tests.h>
24
23
25
24
#include " Firestore/core/src/firebase/firestore/util/autoid.h"
26
25
27
26
#import " Firestore/Source/API/FIRFirestore+Internal.h"
28
27
#import " Firestore/Source/Auth/FSTEmptyCredentialsProvider.h"
28
+ #import " Firestore/Source/Core/FSTFirestoreClient.h"
29
29
#import " Firestore/Source/Local/FSTLevelDB.h"
30
30
#import " Firestore/Source/Model/FSTDatabaseID.h"
31
31
#import " Firestore/Source/Util/FSTDispatchQueue.h"
Original file line number Diff line number Diff line change @@ -167,9 +167,9 @@ - (FSTDocumentDictionary *)localDocuments:(FSTDocumentDictionary *)documents {
167
167
BOOL *stop) {
168
168
FSTMaybeDocument *mutatedDoc = [self localDocument: remoteDocument key: key];
169
169
if ([mutatedDoc isKindOfClass: [FSTDeletedDocument class ]]) {
170
- result = [documents dictionaryByRemovingObjectForKey: key];
170
+ result = [result dictionaryByRemovingObjectForKey: key];
171
171
} else if ([mutatedDoc isKindOfClass: [FSTDocument class ]]) {
172
- result = [documents dictionaryBySettingObject: (FSTDocument *)mutatedDoc forKey: key];
172
+ result = [result dictionaryBySettingObject: (FSTDocument *)mutatedDoc forKey: key];
173
173
} else {
174
174
FSTFail (@" Unknown document: %@ " , mutatedDoc);
175
175
}
You can’t perform that action at this time.
0 commit comments