Skip to content

Commit fb28801

Browse files
committed
fix: resolve invalid hook call in DataTable handleRowClick
1 parent 3f87cec commit fb28801

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/app/components/shared/DataTable.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {BrushCleaning, PlusCircle, Search} from 'lucide-react'
55
import React from "react"
66
import {useGlobalContext} from "@/context/global-context.tsx"
77
import {Button} from "@/components/ui/button"
8-
import {useApplyCookie} from "@/hooks/useCookie.tsx";
98

109
export type DataType = CookieData | SwaggerData;
1110

@@ -28,7 +27,7 @@ export default function DataTable<T extends DataType>({
2827
}: DataTableProps<T>) {
2928
const {
3029
settings, activeProject, setActiveProject, setCurrentView,
31-
searchTerm, clearSearchTerm
30+
searchTerm, clearSearchTerm, handleApply
3231
} = useGlobalContext()
3332

3433
const hasStoredData = () => {
@@ -51,12 +50,7 @@ export default function DataTable<T extends DataType>({
5150

5251
const handleRowClick = (item: T) => {
5352
if (settings.applyOnClick) {
54-
if (type === 'cookie') {
55-
useApplyCookie(item as CookieData)
56-
} else {
57-
const {handleApply} = useGlobalContext()
58-
handleApply(item as SwaggerData)
59-
}
53+
handleApply(item)
6054
}
6155
}
6256

0 commit comments

Comments
 (0)