From 18afe672de34952e3d23678317dd90a53ecf2277 Mon Sep 17 00:00:00 2001 From: Amit Amrutiya Date: Mon, 11 Nov 2024 22:08:14 +0530 Subject: [PATCH] fix: table infinte loading issue Signed-off-by: Amit Amrutiya --- src/custom/CatalogDesignTable/columnConfig.tsx | 16 ++++++++-------- src/custom/ResponsiveDataTable.tsx | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/custom/CatalogDesignTable/columnConfig.tsx b/src/custom/CatalogDesignTable/columnConfig.tsx index d46f4404..ed7260c7 100644 --- a/src/custom/CatalogDesignTable/columnConfig.tsx +++ b/src/custom/CatalogDesignTable/columnConfig.tsx @@ -44,9 +44,9 @@ export const colViews: ColView[] = [ interface ColumnConfigProps { handleShowDetails: (design: Pattern) => void; - handleCloneClick: (design: Pattern) => void; - handleCopyUrl: (design: Pattern) => void; - handleOpenPlayground: (design: Pattern) => void; + handleClone: (designId: string, name: string) => void; + handleCopyUrl: (designId: string, name: string) => void; + handleOpenPlayground: (designId: string, name: string) => void; handleUnpublish?: (design: Pattern) => void; maxWidth?: boolean; getCatalogUrl: (type: string, name: string) => string; @@ -69,7 +69,7 @@ interface ActionItem { export const createDesignColumns = ({ handleShowDetails, - handleCloneClick, + handleClone, handleCopyUrl, handleOpenPlayground, handleUnpublish = () => {}, @@ -292,7 +292,7 @@ export const createDesignColumns = ({ const baseActions: ActionItem[] = [ { title: 'Clone', - onClick: () => handleCloneClick(rowData), + onClick: () => handleClone(rowData.id, rowData.name), disabled: isCloneDisabled, icon: }, @@ -307,7 +307,7 @@ export const createDesignColumns = ({ }, { title: 'Copy Link', - onClick: () => handleCopyUrl(rowData), + onClick: () => handleCopyUrl(rowData.id, rowData.name), icon: }, { @@ -345,11 +345,11 @@ export const createDesignColumns = ({ }, { title: 'Open in playground', - onClick: () => handleOpenPlayground(rowData), + onClick: () => handleOpenPlayground(rowData.id, rowData.name), icon: } ]; - // TODO: make this unbpublish action work for playgroud + const actionsList = showUnpublish ? [ ...baseActions.slice(0, 2), diff --git a/src/custom/ResponsiveDataTable.tsx b/src/custom/ResponsiveDataTable.tsx index 235ec5e9..aa1c51aa 100644 --- a/src/custom/ResponsiveDataTable.tsx +++ b/src/custom/ResponsiveDataTable.tsx @@ -385,7 +385,8 @@ const ResponsiveDataTable = ({ } }); updateCols && updateCols([...columns]); - }, [columnVisibility, updateCols, columns]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [columnVisibility, updateCols]); React.useEffect(() => { updateColumnsEffect();