fix: drop repeated "Connect data blocks" (#1763)
This commit is contained in:
parent
03f845246e
commit
cba7de55d8
@ -5,6 +5,7 @@ import { SharedFilter, mergeFilter } from '../block-provider/SharedFilterProvide
|
||||
import { CollectionFieldOptions, useCollection } from '../collection-manager';
|
||||
import { removeNullCondition } from '../schema-component';
|
||||
import { useAssociatedFields } from './utils';
|
||||
import { uniqBy } from 'lodash';
|
||||
|
||||
type Collection = ReturnType<typeof useCollection>;
|
||||
|
||||
@ -133,8 +134,8 @@ export const useFilterBlock = () => {
|
||||
existingBlock.defaultFilter = block.defaultFilter;
|
||||
return;
|
||||
}
|
||||
|
||||
setDataBlocks((prev) => [...prev, block]);
|
||||
// 由于 setDataBlocks 是异步操作,所以上面的 existingBlock 在判断时有可能用的是旧的 dataBlocks,所以下面还需要根据 uid 进行去重操作
|
||||
setDataBlocks((prev) => uniqBy([...prev, block], 'uid'));
|
||||
};
|
||||
const getDataBlocks = () => dataBlocks;
|
||||
const removeDataBlock = (uid: string) => {
|
||||
|
Loading…
Reference in New Issue
Block a user