Skip to content

Commit

Permalink
Merge pull request #805 from amitamrutiya/fix-table
Browse files Browse the repository at this point in the history
fix: responsive table infinte render issue
  • Loading branch information
amitamrutiya authored Nov 11, 2024
2 parents 585d863 + 18afe67 commit 983711b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/custom/CatalogDesignTable/columnConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -69,7 +69,7 @@ interface ActionItem {

export const createDesignColumns = ({
handleShowDetails,
handleCloneClick,
handleClone,
handleCopyUrl,
handleOpenPlayground,
handleUnpublish = () => {},
Expand Down Expand Up @@ -292,7 +292,7 @@ export const createDesignColumns = ({
const baseActions: ActionItem[] = [
{
title: 'Clone',
onClick: () => handleCloneClick(rowData),
onClick: () => handleClone(rowData.id, rowData.name),
disabled: isCloneDisabled,
icon: <CopyIcon width={24} height={24} fill={theme.palette.text.primary} />
},
Expand All @@ -307,7 +307,7 @@ export const createDesignColumns = ({
},
{
title: 'Copy Link',
onClick: () => handleCopyUrl(rowData),
onClick: () => handleCopyUrl(rowData.id, rowData.name),
icon: <ChainIcon width={'24'} height={'24'} fill={theme.palette.text.primary} />
},
{
Expand Down Expand Up @@ -345,11 +345,11 @@ export const createDesignColumns = ({
},
{
title: 'Open in playground',
onClick: () => handleOpenPlayground(rowData),
onClick: () => handleOpenPlayground(rowData.id, rowData.name),
icon: <KanvasIcon width={24} height={24} primaryFill={theme.palette.text.primary} />
}
];
// TODO: make this unbpublish action work for playgroud

const actionsList = showUnpublish
? [
...baseActions.slice(0, 2),
Expand Down
3 changes: 2 additions & 1 deletion src/custom/ResponsiveDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 983711b

Please sign in to comment.