From 2867c8301ded322fd1bd01666fe5db89422b09f5 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Mon, 17 Feb 2025 19:40:58 +0100 Subject: [PATCH] refactor: stabilise table options --- .../views/cuesheet/cuesheet-table/CuesheetTable.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/client/src/views/cuesheet/cuesheet-table/CuesheetTable.tsx b/apps/client/src/views/cuesheet/cuesheet-table/CuesheetTable.tsx index 0a9a1f084..b852781a8 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table/CuesheetTable.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table/CuesheetTable.tsx @@ -1,4 +1,4 @@ -import { useRef } from 'react'; +import { useCallback, useRef } from 'react'; import { ColumnDef, flexRender, getCoreRowModel, useReactTable } from '@tanstack/react-table'; import Color from 'color'; import { @@ -92,13 +92,13 @@ export default function CuesheetTable(props: CuesheetTableProps) { }, }); - const setAllVisible = () => { + const setAllVisible = useCallback(() => { table.toggleAllColumnsVisible(true); - }; + }, []); - const resetColumnResizing = () => { + const resetColumnResizing = useCallback(() => { setColumnSizing({}); - }; + }, []); const headerGroups = table.getHeaderGroups(); const rowModel = table.getRowModel();