ElemeFE / ElemeFE/element-react
After searching in select, it triggers when the keyboard is up/down, and the page crashes. errMsg:Uncaught Invariant Violation: Maximum update depth exceeded.
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 435
- PR merge metrics
- No merged PRs in 30d
Description
### Description
After searching in select, it triggers when the keyboard is up/down, and the page crashes.
Errors were reported as follows:
Uncaught Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
### Reproduce Steps
After searching in select, it triggers when the keyboard is up/down, and the page crashes.
### Error Trace (if possible)
Uncaught Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
### Solution
value: function navigateOptions(direction) {
...
...
...
if (options.length != options.filter(function (item) {
return item.props.disabled === true;
}).length) {
if (direction === 'next') {
hoverIndex++;
while ( hoverIndex < options.length && options[hoverIndex].props.disabled === true || options[hoverIndex].props.groupDisabled === true || !options[hoverIndex].state.visible) {
hoverIndex++;
}
if (hoverIndex === options.length) {
hoverIndex = 0;
}
}
if (direction === 'prev') {
hoverIndex--;
while ( hoverIndex > 0 && options[hoverIndex].props.disabled === true || options[hoverIndex].props.groupDisabled === true || !options[hoverIndex].state.visible) {
hoverIndex--;
}
if (hoverIndex < 0) {
hoverIndex = options.length - 1;
}
}
}
...
...
}
### Additional Information
1. There are still some problems with this change, such as: the upper and lower keys can only flip the visual area;
2. I see that the props attribute does not exist.
Contributor guide
Assessment
This issue has not been assessed yet.