From 29d5a8c9710b9280ec132ee0a3072fad082816ed Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Wed, 27 Jul 2022 16:12:54 +0800 Subject: [PATCH] chore: remove property correct --- libs/components/editor-core/src/recast-block/property.ts | 6 ++---- libs/components/editor-core/src/recast-block/types/index.ts | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/components/editor-core/src/recast-block/property.ts b/libs/components/editor-core/src/recast-block/property.ts index c830c5e30b..e8f0104269 100644 --- a/libs/components/editor-core/src/recast-block/property.ts +++ b/libs/components/editor-core/src/recast-block/property.ts @@ -248,10 +248,8 @@ export const getRecastItemValue = (block: RecastItem | AsyncBlock) => { }; const removeValue = (propertyId: RecastPropertyId) => { - return recastItem.setProperty(TABLE_VALUES_KEY, { - ...props, - [propertyId]: null, - }); + const { [propertyId]: omitted, ...restProps } = props; + return recastItem.setProperty(TABLE_VALUES_KEY, restProps); }; return { getAllValue, getValue, setValue, removeValue }; }; diff --git a/libs/components/editor-core/src/recast-block/types/index.ts b/libs/components/editor-core/src/recast-block/types/index.ts index e1a097ebe6..e7e44d347d 100644 --- a/libs/components/editor-core/src/recast-block/types/index.ts +++ b/libs/components/editor-core/src/recast-block/types/index.ts @@ -18,6 +18,7 @@ type VariantBlock = Omit< value: Props[T] ): Promise; setProperties(value: Partial): Promise; + removeProperty(key: T): Promise; }; export type RecastBlock = VariantBlock;