From be1a2696b0f6a3727b450831d12fbe7d69ca7f4e Mon Sep 17 00:00:00 2001 From: Sulaiman Hamouda Date: Thu, 1 Aug 2024 17:09:58 -0400 Subject: [PATCH] Fix lint errors --- packages/ui/app/src/mdx/components/tabs/Tabs.tsx | 3 +-- packages/ui/app/src/mdx/hooks/useTabSelection.ts | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/ui/app/src/mdx/components/tabs/Tabs.tsx b/packages/ui/app/src/mdx/components/tabs/Tabs.tsx index e8ee498ad3..8b930c08c9 100644 --- a/packages/ui/app/src/mdx/components/tabs/Tabs.tsx +++ b/packages/ui/app/src/mdx/components/tabs/Tabs.tsx @@ -24,12 +24,11 @@ export const TabGroup: FC = ({ tabs, groupId, toc: parentToc = tr useEffect(() => { if (anchor != null) { const anchorTab = tabs.findIndex((tab) => slug(tab.title) === anchor); - if (anchorTab >= 0) { setSelected(anchorTab.toString()); } } - }, [anchor, tabs]); + }, [anchor, tabs, setSelected]); return ( diff --git a/packages/ui/app/src/mdx/hooks/useTabSelection.ts b/packages/ui/app/src/mdx/hooks/useTabSelection.ts index 244e942ca6..fa7c25cb1a 100644 --- a/packages/ui/app/src/mdx/hooks/useTabSelection.ts +++ b/packages/ui/app/src/mdx/hooks/useTabSelection.ts @@ -2,7 +2,11 @@ import { useAtom } from "jotai"; import { useEffect, useState } from "react"; import { FERN_GROUPS, Group, useGroup } from "../../atoms"; -export const useTabSelection = ({ groupId }: { groupId?: string }) => { +export const useTabSelection: = ({ + groupId, +}: { + groupId?: string; +}): { selected: string; setSelected: (val: string) => void } => { const { selectedGroup } = useGroup({ key: groupId }); const [_, setGroups] = useAtom(FERN_GROUPS); const [selectedTabIndex, setSelectedTabIndex] = useState("0");