You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the presence type is defined to extend Indexable, and when transmitting presence via protobuf, it is converted to a string using JSON.stringify.
The current type <P extends Indexable> allows any type as its value since type Indexable = Record<string, any>. Consequently, values that are not JSON serializable, such as byte array, Date, and Long, may not work correctly. Therefore, it is essential to restrict the type of P(presence) to only allow JSON serializable types not Indexable.
Description:
Currently, the presence type is defined to extend
Indexable
, and when transmitting presence via protobuf, it is converted to a string usingJSON.stringify
.yorkie-js-sdk/src/document/document.ts
Line 388 in effd586
yorkie-js-sdk/src/api/yorkie/v1/resources.proto
Lines 307 to 309 in 02e9bc0
JSON.stringify
: Fix bug when setting non-string values in Presence #311The current type
<P extends Indexable>
allows any type as its value sincetype Indexable = Record<string, any>
. Consequently, values that are not JSON serializable, such asbyte array
,Date
, andLong
, may not work correctly. Therefore, it is essential to restrict the type ofP
(presence) to only allow JSON serializable types notIndexable
.Reference) JSON type used in other libraries:
Why:
Using non-JSON serializable values in the presence type may lead to unexpected behavior.
The text was updated successfully, but these errors were encountered: