-
-
Notifications
You must be signed in to change notification settings - Fork 243
Open
Description
in this function, sometimes the startIndex is bigger than the endIndex, causing the menu for hiddenTabs in TabNavList to have duplicated items.
I guess some tab extra element with user defined css can cause it to measure things incorrectly.
tabs/src/hooks/useVisibleRange.ts
Lines 42 to 61 in a4ce7c4
const len = tabs.length; | |
let endIndex = len; | |
for (let i = 0; i < len; i += 1) { | |
const offset = tabOffsets.get(tabs[i].key) || DEFAULT_SIZE; | |
if (offset[position] + offset[unit] > transformSize + mergedBasicSize) { | |
endIndex = i - 1; | |
break; | |
} | |
} | |
let startIndex = 0; | |
for (let i = len - 1; i >= 0; i -= 1) { | |
const offset = tabOffsets.get(tabs[i].key) || DEFAULT_SIZE; | |
if (offset[position] < transformSize) { | |
startIndex = i + 1; | |
break; | |
} | |
} | |
return [startIndex, endIndex]; |
could we add a simple protection like
if (startIndex > endIndex) {
endIndex = startIndex;
}
embeoo
Metadata
Metadata
Assignees
Labels
No labels