tabs
tabs copied to clipboard
duplicate key in tabs overflow menu
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.
https://github.com/react-component/tabs/blob/a4ce7c465f75ae7f4004807dd5f3af435889808e/src/hooks/useVisibleRange.ts#L42-L61
could we add a simple protection like
if (startIndex > endIndex) {
endIndex = startIndex;
}
you can reproduce it in the above example.
also it only happens for 1 or 2 frames, and when you actually open the dropdown, you will never see the duplicated item.
So it might also be some timing issue between react hooks that messed up with the measuring.
PR is welcome
Can we get the PR merged?