Skip to content

Commit dccd5d2

Browse files
committed
feat: simplify loadDataFun's logic
1 parent 8acc1c8 commit dccd5d2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/OptionList.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
205205
const [preSearchValue] = pre;
206206
const [nextSearchValue, nextExcludeSearchExpandedKeys] = next;
207207

208-
if (preSearchValue !== nextSearchValue) {
208+
if (
209+
preSearchValue === nextSearchValue ||
209210
// should not pass `loadData` when expandedKeys is not changed
210-
if (!nextSearchValue && !nextExcludeSearchExpandedKeys) {
211-
return false;
212-
}
213-
return true;
211+
(!nextSearchValue && !nextExcludeSearchExpandedKeys)
212+
) {
213+
return false;
214214
}
215-
return false;
215+
return true;
216216
},
217217
);
218218

0 commit comments

Comments
 (0)