Skip to content

Commit 29ef7c2

Browse files
fix(firestore, web): fix apply method for arrayRemove & arrayUnion (#9281)
1 parent c2771a4 commit 29ef7c2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/cloud_firestore/cloud_firestore_web/lib/src/interop/firestore.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ class _FieldValueArrayUnion extends _FieldValueArray {
707707
firestore_interop.FieldValue? _jsify() {
708708
// This uses var arg so cannot use js package
709709
return callMethod(
710-
firestore_interop.arrayUnion, 'apply', jsify([null, elements]));
710+
firestore_interop.arrayUnion, 'apply', [null, jsify(elements)]);
711711
}
712712

713713
@override
@@ -721,7 +721,7 @@ class _FieldValueArrayRemove extends _FieldValueArray {
721721
firestore_interop.FieldValue? _jsify() {
722722
// This uses var arg so cannot use js package
723723
return callMethod(
724-
firestore_interop.arrayRemove, 'apply', jsify([null, elements]));
724+
firestore_interop.arrayRemove, 'apply', [null, jsify(elements)]);
725725
}
726726

727727
@override

packages/cloud_firestore/cloud_firestore_web/lib/src/interop/firestore_interop.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ external PromiseJsImpl<DocumentReferenceJsImpl> addDoc(
2828
dynamic data,
2929
);
3030

31-
@JS()
32-
external FieldValue arrayRemove(dynamic elements);
33-
34-
@JS()
35-
external FieldValue arrayUnion(dynamic elements);
36-
3731
@JS()
3832
external PromiseJsImpl<void> clearIndexedDbPersistence(
3933
FirestoreJsImpl firestore,
@@ -637,7 +631,7 @@ abstract class SnapshotOptions {
637631
external factory SnapshotOptions({String? serverTimestamps});
638632
}
639633

640-
// We type those 4 functions as Object to avoid an issue with dart2js compilation
634+
// We type these 6 functions as Object to avoid an issue with dart2js compilation
641635
// in release mode
642636
// Discussed internally with dart2js team
643637
@JS()
@@ -651,3 +645,9 @@ external Object get endBefore;
651645

652646
@JS()
653647
external Object get endAt;
648+
649+
@JS()
650+
external Object get arrayRemove;
651+
652+
@JS()
653+
external Object get arrayUnion;

0 commit comments

Comments
 (0)