Skip to content

Commit

Permalink
chore: add all dependencies to loadDataFun
Browse files Browse the repository at this point in the history
  • Loading branch information
bbb169 committed Oct 18, 2024
1 parent 1f79277 commit 9a2ef31
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/OptionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,14 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
onKeyUp: () => {},
}));


const loadDataFun = React.useMemo(() => {
// should not pass `loadData` when expandedKeys is not changed
if (!searchValue && searchExpandedKeys?.length && !mergedExpandedKeys) {
return null
return null;
}

return searchValue ? null : (loadData as any)
}, [searchValue])
return searchValue ? null : (loadData as any);
}, [searchValue, searchExpandedKeys?.length, mergedExpandedKeys, loadData]);

// ========================== Render ==========================
if (memoTreeData.length === 0) {
Expand Down

0 comments on commit 9a2ef31

Please sign in to comment.