tabs icon indicating copy to clipboard operation
tabs copied to clipboard

duplicate key in tabs overflow menu

Open rinick opened this issue 3 years ago • 3 comments

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;
}

rinick avatar Nov 12 '21 20:11 rinick

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.

rinick avatar Nov 12 '21 20:11 rinick

PR is welcome

afc163 avatar Dec 08 '21 11:12 afc163

Can we get the PR merged?

mahileeb avatar Feb 16 '22 02:02 mahileeb