Skip to content

Commit

Permalink
Fix "Proxy object could not be cloned."
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan committed May 3, 2023
1 parent c8755fe commit bc93094
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/ui/src/proxyApi/models/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,13 @@ const serializeCodec = (codec: Codec): SerializedCodec => {
}

const properties = (Object.getOwnPropertyNames(Object.getPrototypeOf(codec)) as (keyof Codec)[])
.map((key) => [key, codec[key]])
.filter(([, prop]) => !isFunction(prop))
.map<[keyof Codec, Codec[keyof Codec]]>((key) => [key, codec[key]])
.filter(
([key, prop]) =>
!['encodedLength', 'hash', 'initialU8aLength', 'isEmpty', 'registry', 'createdAtHash'].includes(key) &&
!isFunction(prop) &&
!Object.getOwnPropertyDescriptor(codec, key)
)

return properties.length > 0
? { ...serializedCodec, properties: serializePayload(Object.fromEntries(properties)) }
Expand Down

0 comments on commit bc93094

Please sign in to comment.