Skip to content

Commit 4f30e11

Browse files
authored
Merge pull request #421 from fmasa/fix-save
Fix save of nullable fields
2 parents 3205e22 + 5d6f61c commit 4f30e11

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/core/firebase/firestore/SetWithTopLevelFieldMerge.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,16 @@ suspend fun <T : Any> DocumentReference.setWithTopLevelFieldsMerge(
6767
)
6868
}
6969

70+
private val json =
71+
Json {
72+
encodeDefaults = true
73+
}
74+
7075
private fun <T> getTopLevelFields(
7176
strategy: SerializationStrategy<T>,
7277
data: T,
7378
): Array<String> {
74-
return Json.encodeToJsonElement(strategy, data)
79+
return json.encodeToJsonElement(strategy, data)
7580
.jsonObject
7681
.keys
7782
.toTypedArray()

0 commit comments

Comments
 (0)