Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/suggestion/useActive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default function useActive(
});

React.useEffect(() => {
if(items?.length === 0) return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加了对items为空数组的检查,确保在items为空时提前返回,避免后续对空数组的操作。这是一个重要的修复,防止了潜在的运行时错误。

if (open) {
setActivePaths([items[0].value]);
}
Expand Down