Added remark about handling class instances ...

when validating `value` in `transactionApi.set(pointer, value)` where `pointer` points to a compound prop.

https://github.com/theatre-js/theatre/pull/118#discussion_r846629352
This commit is contained in:
Aria Minaei 2022-04-09 17:32:36 +02:00
parent 64874d644b
commit 2c7591b589

View file

@ -113,6 +113,10 @@ export const compound = <Props extends IShorthandCompoundProps>(
return deserializationCache.get(json) return deserializationCache.get(json)
} }
// TODO we should probably also check here whether `json` is a pure object rather
// than an instance of a class, just to avoid the possible edge cases of handling
// class instances.
const deserialized: $FixMe = {} const deserialized: $FixMe = {}
let atLeastOnePropWasDeserialized = false let atLeastOnePropWasDeserialized = false
for (const [key, propConfig] of Object.entries(sanitizedProps)) { for (const [key, propConfig] of Object.entries(sanitizedProps)) {