Skip to content

Commit

Permalink
Merge pull request #489 from splendo/fix-js-document-id
Browse files Browse the repository at this point in the history
Fix fr DocumentId not working on JS
  • Loading branch information
nbransby authored Apr 4, 2024
2 parents bccc1a9 + d36ddfc commit 2e736d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import dev.gitlive.firebase.externals.FirebaseApp
import kotlin.js.Json
import kotlin.js.Promise

external fun documentId(): FieldPath

external class FieldPath(vararg fieldNames: String) {
companion object {
val documentId: FieldPath
}
fun isEqual(other: FieldPath): Boolean

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import dev.gitlive.firebase.firestore.externals.clearIndexedDbPersistence
import dev.gitlive.firebase.firestore.externals.connectFirestoreEmulator
import dev.gitlive.firebase.firestore.externals.deleteDoc
import dev.gitlive.firebase.firestore.externals.doc
import dev.gitlive.firebase.firestore.externals.documentId as jsDocumentId
import dev.gitlive.firebase.firestore.externals.enableIndexedDbPersistence
import dev.gitlive.firebase.firestore.externals.getDoc
import dev.gitlive.firebase.firestore.externals.getDocs
Expand Down Expand Up @@ -440,10 +441,10 @@ actual class SnapshotMetadata(val js: JsSnapshotMetadata) {
actual class FieldPath private constructor(val js: JsFieldPath) {

actual companion object {
actual val documentId = FieldPath(JsFieldPath.documentId)
actual val documentId = FieldPath(jsDocumentId())
}
actual constructor(vararg fieldNames: String) : this(dev.gitlive.firebase.firestore.rethrow {
js("Reflect").construct(JsFieldPath, fieldNames).unsafeCast<JsFieldPath>()
JsFieldPath(*fieldNames)
})
actual val documentId: FieldPath get() = FieldPath.documentId
actual val encoded: EncodedFieldPath = js
Expand Down

0 comments on commit 2e736d4

Please sign in to comment.