From 2c7591b58924f1af7de399ce60097278bf9ef56b Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Sat, 9 Apr 2022 17:32:36 +0200 Subject: [PATCH] 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 --- theatre/core/src/propTypes/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/theatre/core/src/propTypes/index.ts b/theatre/core/src/propTypes/index.ts index db8ef33..54836eb 100644 --- a/theatre/core/src/propTypes/index.ts +++ b/theatre/core/src/propTypes/index.ts @@ -113,6 +113,10 @@ export const compound = ( 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 = {} let atLeastOnePropWasDeserialized = false for (const [key, propConfig] of Object.entries(sanitizedProps)) {