From 5b2aded7e1de81cacbf5e92bc08b7b87ccebe401 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 29 Jun 2023 15:00:58 -0400 Subject: from last --- src/fields/util.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/fields/util.ts b/src/fields/util.ts index e439768ee..0f164a709 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -34,9 +34,8 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number return true; } - if (value !== undefined) { - value = value[SelfProxy] || value; - } + value = value?.[SelfProxy] ?? value; // convert any Doc type values to Proxy's + const curValue = target.__fieldTuples[prop]; if (curValue === value || (curValue instanceof ProxyField && value instanceof RefField && curValue.fieldId === value[Id])) { // TODO This kind of checks correctly in the case that curValue is a ProxyField and value is a RefField, but technically -- cgit v1.2.3-70-g09d2