Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fr DocumentId not working on JS #489

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading