Skip to content

Commit 9a2ef31

Browse files
committed
chore: add all dependencies to loadDataFun
1 parent 1f79277 commit 9a2ef31

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/OptionList.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,14 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
196196
onKeyUp: () => {},
197197
}));
198198

199-
200199
const loadDataFun = React.useMemo(() => {
201200
// should not pass `loadData` when expandedKeys is not changed
202201
if (!searchValue && searchExpandedKeys?.length && !mergedExpandedKeys) {
203-
return null
202+
return null;
204203
}
205204

206-
return searchValue ? null : (loadData as any)
207-
}, [searchValue])
205+
return searchValue ? null : (loadData as any);
206+
}, [searchValue, searchExpandedKeys?.length, mergedExpandedKeys, loadData]);
208207

209208
// ========================== Render ==========================
210209
if (memoTreeData.length === 0) {

0 commit comments

Comments
 (0)