From 411a49f6ddf15a108fc90335fa5ec07a642b4477 Mon Sep 17 00:00:00 2001 From: Amit Amrutiya Date: Mon, 18 Nov 2024 10:03:36 +0530 Subject: [PATCH] feat: add styles for PerformersSection component Signed-off-by: Amit Amrutiya --- src/custom/ResponsiveDataTable.tsx | 60 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/custom/ResponsiveDataTable.tsx b/src/custom/ResponsiveDataTable.tsx index 230822db..de09a30b 100644 --- a/src/custom/ResponsiveDataTable.tsx +++ b/src/custom/ResponsiveDataTable.tsx @@ -310,42 +310,39 @@ const ResponsiveDataTable = ({ return new Intl.DateTimeFormat('en-US', dateOptions).format(date); }; - const updatedOptions = React.useMemo( - () => ({ - ...options, - print: false, - download: false, - search: false, - filter: false, - viewColumns: false, - rowsPerPageOptions: rowsPerPageOptions, - onViewColumnsChange: (column: string, action: string) => { - switch (action) { - case 'add': { - const colToAdd = columns.find((obj) => obj.name === column); - if (colToAdd) { - if (colToAdd.options) { - colToAdd.options.display = true; - updateCols && updateCols([...columns]); - } + const updatedOptions = { + ...options, + print: false, + download: false, + search: false, + filter: false, + viewColumns: false, + rowsPerPageOptions: rowsPerPageOptions, + onViewColumnsChange: (column: string, action: string) => { + switch (action) { + case 'add': { + const colToAdd = columns.find((obj) => obj.name === column); + if (colToAdd) { + if (colToAdd.options) { + colToAdd.options.display = true; + updateCols && updateCols([...columns]); } - break; } - case 'remove': { - const colToRemove = columns.find((obj) => obj.name === column); - if (colToRemove) { - if (colToRemove.options) { - colToRemove.options.display = false; - updateCols && updateCols([...columns]); - } + break; + } + case 'remove': { + const colToRemove = columns.find((obj) => obj.name === column); + if (colToRemove) { + if (colToRemove.options) { + colToRemove.options.display = false; + updateCols && updateCols([...columns]); } - break; } + break; } } - }), - [options, rowsPerPageOptions, columns, updateCols] - ); + } + }; const updateColumnsEffect = useCallback(() => { columns?.forEach((col) => { @@ -388,7 +385,8 @@ const ResponsiveDataTable = ({ } }); updateCols && updateCols([...columns]); - }, [columnVisibility, updateCols, columns]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [columnVisibility, updateCols]); React.useEffect(() => { updateColumnsEffect();