Skip to content

Commit

Permalink
fix: removed unused import, type-checked before .replace
Browse files Browse the repository at this point in the history
  • Loading branch information
axelEandrews committed Jul 11, 2024
1 parent f3701a8 commit 14e72ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/react/src/primitives/Tabs/TabsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { BaseTabsProps, TabsProps } from './types';
import { View } from '../View';
import { TabsContext } from './TabsContext';
import { useStableId } from '../utils/useStableId';
import { WHITESPACE_VALUE } from './constants';

const TabsContainerPrimitive: Primitive<TabsProps, 'div'> = (
{
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/primitives/Tabs/TabsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const TabsItemPrimitive: Primitive<TabsItemProps, 'button'> = (
ref
) => {
const { activeTab, setActiveTab, groupId } = React.useContext(TabsContext);
const idValue = value.replace(' ', WHITESPACE_VALUE);
let idValue = value;
if (typeof idValue === 'string') {
idValue = idValue.replace(' ', WHITESPACE_VALUE);
}
const isActive = activeTab === value;
const handleOnClick = (e: React.MouseEvent<HTMLButtonElement>) => {
if (isTypedFunction(onClick)) {
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/primitives/Tabs/TabsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ const TabPanelPrimitive: Primitive<TabsPanelProps, 'div'> = (

if (isLazy && activeTab !== value) return null;

const idValue = value.replace(' ', WHITESPACE_VALUE);
let idValue = value;
if (typeof idValue === 'string') {
idValue = idValue.replace(' ', WHITESPACE_VALUE);
}

return (
<View
Expand Down

0 comments on commit 14e72ac

Please sign in to comment.