From 815768c91df415fc58ea2f47bf3316ed138fbb87 Mon Sep 17 00:00:00 2001 From: Rairn <958414905@qq.com> Date: Mon, 20 Mar 2023 18:00:07 +0800 Subject: [PATCH] fix(Filter-blocks): should remove option when deleting block --- packages/core/client/src/filter-provider/FilterProvider.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/filter-provider/FilterProvider.tsx b/packages/core/client/src/filter-provider/FilterProvider.tsx index a03e56e117..3df7c6e625 100644 --- a/packages/core/client/src/filter-provider/FilterProvider.tsx +++ b/packages/core/client/src/filter-provider/FilterProvider.tsx @@ -78,7 +78,7 @@ export const FilterBlockRecord = ({ useEffect(() => { return () => { - removeDataBlock(field.props.name as string); + removeDataBlock(fieldSchema['x-uid']); }; }, []); @@ -113,8 +113,8 @@ export const useFilterBlock = () => { setDataBlocks((prev) => [...prev, block]); }; const getDataBlocks = () => dataBlocks; - const removeDataBlock = (name: string) => { - setDataBlocks((prev) => prev.filter((item) => item.uid !== name)); + const removeDataBlock = (uid: string) => { + setDataBlocks((prev) => prev.filter((item) => item.uid !== uid)); }; return { recordDataBlocks, getDataBlocks, removeDataBlock };