Skip to content

Commit 4d0b36e

Browse files
chore(@clayui/core): replace createLayoutItemLazy by createPartialLayoutItem
1 parent f5f9ac9 commit 4d0b36e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

packages/clay-core/src/tree-view/useItem.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ export function ItemContextProvider({children, value}: Props) {
2929

3030
const keyRef = useRef(getKey(value.key));
3131

32-
useEffect(() => selection.createLayoutItemLazy(keyRef.current, parentKey), [
33-
selection.createLayoutItemLazy,
34-
keyRef,
35-
parentKey,
36-
]);
32+
useEffect(
33+
() => selection.createPartialLayoutItem(keyRef.current, parentKey),
34+
[selection.createPartialLayoutItem, keyRef, parentKey]
35+
);
3736

3837
const props = {
3938
...value,

packages/clay-core/src/tree-view/useMultipleSelection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface IMultipleSelection {
1919
}
2020

2121
export interface IMultipleSelectionState {
22-
createLayoutItemLazy: (key: Key, parentKey?: Key) => () => void;
22+
createPartialLayoutItem: (key: Key, parentKey?: Key) => () => void;
2323
isIntermediate: (key: Key) => boolean;
2424
selectedKeys: Set<Key>;
2525
toggleSelection: (key: Key) => void;
@@ -136,7 +136,7 @@ export function useMultipleSelection(
136136
// stream. This means it is reactive to rendering, if any component of the
137137
// structure is removed it will update the layout without going traverse
138138
// the structure.
139-
const createLayoutItemLazy = useCallback(
139+
const createPartialLayoutItem = useCallback(
140140
(key: Key, parentKey?: Key) => {
141141
const keyMap = layoutKeys.current.get(key);
142142

@@ -214,7 +214,7 @@ export function useMultipleSelection(
214214
};
215215

216216
return {
217-
createLayoutItemLazy,
217+
createPartialLayoutItem,
218218
isIntermediate,
219219
selectedKeys,
220220
toggleSelection,

0 commit comments

Comments
 (0)