mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Fixed possible undefined error in TreeContext reducer (#24501)
This commit is contained in:
@@ -377,12 +377,11 @@ function reduceTreeState(store: Store, state: State, action: Action): State {
|
||||
}
|
||||
break;
|
||||
case 'SELECT_PREVIOUS_ELEMENT_WITH_ERROR_OR_WARNING_IN_TREE': {
|
||||
if (store.errorCount === 0 && store.warningCount === 0) {
|
||||
const elementIndicesWithErrorsOrWarnings = store.getElementsWithErrorsAndWarnings();
|
||||
if (elementIndicesWithErrorsOrWarnings.length === 0) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const elementIndicesWithErrorsOrWarnings = store.getElementsWithErrorsAndWarnings();
|
||||
|
||||
let flatIndex = 0;
|
||||
if (selectedElementIndex !== null) {
|
||||
// Resume from the current position in the list.
|
||||
@@ -419,12 +418,11 @@ function reduceTreeState(store: Store, state: State, action: Action): State {
|
||||
break;
|
||||
}
|
||||
case 'SELECT_NEXT_ELEMENT_WITH_ERROR_OR_WARNING_IN_TREE': {
|
||||
if (store.errorCount === 0 && store.warningCount === 0) {
|
||||
const elementIndicesWithErrorsOrWarnings = store.getElementsWithErrorsAndWarnings();
|
||||
if (elementIndicesWithErrorsOrWarnings.length === 0) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const elementIndicesWithErrorsOrWarnings = store.getElementsWithErrorsAndWarnings();
|
||||
|
||||
let flatIndex = -1;
|
||||
if (selectedElementIndex !== null) {
|
||||
// Resume from the current position in the list.
|
||||
|
||||
Reference in New Issue
Block a user