diff --git a/frontend/src/container/ListOfDashboard/index.tsx b/frontend/src/container/ListOfDashboard/index.tsx index 9a91d72331..60da406603 100644 --- a/frontend/src/container/ListOfDashboard/index.tsx +++ b/frontend/src/container/ListOfDashboard/index.tsx @@ -75,8 +75,8 @@ function ListOfAllDashboard(): JSX.Element { errorMessage: '', }); - const columns: TableColumnProps[] = useMemo( - () => [ + const columns = useMemo(() => { + const tableColumns: TableColumnProps[] = [ { title: 'Name', dataIndex: 'name', @@ -118,19 +118,19 @@ function ListOfAllDashboard(): JSX.Element { }, render: DateComponent, }, - ], - [], - ); + ]; - if (action) { - columns.push({ - title: 'Action', - dataIndex: '', - key: 'x', - width: 40, - render: DeleteButton, - }); - } + if (action) { + tableColumns.push({ + title: 'Action', + dataIndex: '', + width: 40, + render: DeleteButton, + }); + } + + return tableColumns; + }, [action]); const data: Data[] = (filteredDashboards || dashboards).map((e) => ({ createdBy: e.created_at,