Skip to content

Commit

Permalink
Don't encode ',null' unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
squarejesse committed Aug 26, 2024
1 parent 869ad50 commit 6e5fa9c
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@ internal class FastGuestProtocolAdapter(

value.forEach { element ->
val (tag, serializer) = widgetSystemFactory.modifierTagAndSerializationStrategy(element)
val value = when {
serializer == null -> null
else -> json.encodeToDynamic(serializer, element)
when {
serializer != null -> {
val value = json.encodeToDynamic(serializer, element)
elements.push(js("""[tag,value]"""))
}
else -> {
elements.push(js("""[tag]"""))
}
}
elements.push(js("""[tag,value]"""))
}

val id = id
Expand Down

0 comments on commit 6e5fa9c

Please sign in to comment.