Skip to content

Commit df46583

Browse files
committed
Fix save of nullable fields
1 parent 3205e22 commit df46583

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

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

70+
private val json = Json {
71+
encodeDefaults = true
72+
}
73+
7074
private fun <T> getTopLevelFields(
7175
strategy: SerializationStrategy<T>,
7276
data: T,
7377
): Array<String> {
74-
return Json.encodeToJsonElement(strategy, data)
78+
return json.encodeToJsonElement(strategy, data)
7579
.jsonObject
7680
.keys
7781
.toTypedArray()

0 commit comments

Comments
 (0)