Skip to content

Commit 383ba30

Browse files
fethijTewelde, Fethi (F.)
andauthored
fix: Redundant creation of Json format. Creating instances for each usage can be slow. (#211)
--------- Co-authored-by: Tewelde, Fethi (F.) <[email protected]>
1 parent 4bfaa3b commit 383ba30

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class SupabaseConnector(
3636
public val powerSyncEndpoint: String,
3737
private val storageBucket: String? = null,
3838
) : PowerSyncBackendConnector() {
39+
private val json = Json { coerceInputValues = true }
3940
private var errorCode: String? = null
4041

4142
private object PostgresFatalCodes {
@@ -98,7 +99,7 @@ public class SupabaseConnector(
9899

99100
try {
100101
val error =
101-
Json { coerceInputValues = true }.decodeFromString<Map<String, String?>>(
102+
json.decodeFromString<Map<String, String?>>(
102103
responseText,
103104
)
104105
errorCode = error["code"]

0 commit comments

Comments
 (0)