Skip to content

Conversation

@coderz-w
Copy link
Contributor

@coderz-w coderz-w commented Jun 10, 2024

Comment on lines 75 to 87
const isSubPathKey = useCallback(
(pathKeys: string[], eventKey: string) =>
pathKeys.some(pathKey => {
(pathKeys: string[], eventKey: string) => {
if (pathKeys.every(key => key === undefined)) {
return false;
}
return pathKeys.some(pathKey => {
const pathKeyList = getKeyPath(pathKey, true);

return pathKeyList.includes(eventKey);
}),
});
},
[getKeyPath],
);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isSubPathKey = useCallback(
(pathKeys: string[], eventKey: string) =>
pathKeys.some(pathKey => {
(pathKeys: string[], eventKey: string) => {
if (pathKeys.every(key => key === undefined)) {
return false;
}
return pathKeys.some(pathKey => {
const pathKeyList = getKeyPath(pathKey, true);
return pathKeyList.includes(eventKey);
}),
});
},
[getKeyPath],
);
const isSubPathKey = useCallback(
(pathKeys: string[], eventKey: string) =>
pathKeys.filter(item => item !== undefined).some(pathKey => {
const pathKeyList = getKeyPath(pathKey, true);
return pathKeyList.includes(eventKey);
}),
[getKeyPath],
);

Copy link
Member

Choose a reason for hiding this comment

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

这样是不更简单点?

@afc163
Copy link
Member

afc163 commented Jun 10, 2024

需要补充用例。

@coderz-w
Copy link
Contributor Author

需要补充用例。

好,佬之前那个看一下react-component/upload#559

@afc163 afc163 merged commit 526a924 into react-component:master Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants