Skip to content

Commit

Permalink
fix: Improve minimal performance of code
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Apr 16, 2022
1 parent 05ab1e9 commit 58caf6a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/UncontrolledTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,12 @@ const UncontrolledTabs = (props) => {
determineCanUseActiveElement(environment);
}

if (canUseActiveElement) {
const env =
environment || (typeof window !== 'undefined' ? window : undefined);
if (canUseActiveElement && env) {
wasTabFocused = React.Children.toArray(child.props.children)
.filter(isTab)
.some((tab, i) => {
const env =
environment ||
(typeof window !== 'undefined' ? window : undefined);
return env && env.document.activeElement === getTab(i);
});
.some((tab, i) => env.document.activeElement === getTab(i));
}

result = cloneElement(child, {
Expand Down

0 comments on commit 58caf6a

Please sign in to comment.