From 07dc6c2197475b98edc56d381284bda7bda0ef55 Mon Sep 17 00:00:00 2001 From: Arpit Date: Fri, 3 Dec 2021 13:52:50 +0530 Subject: [PATCH] Bugfix: cell value does not change when the value on the inspector is updated [table widget] (#1440) --- .../src/Editor/Components/Table/Table.jsx | 216 +++++++++--------- 1 file changed, 110 insertions(+), 106 deletions(-) diff --git a/frontend/src/Editor/Components/Table/Table.jsx b/frontend/src/Editor/Components/Table/Table.jsx index 8b43435988..7fdbce03cd 100644 --- a/frontend/src/Editor/Components/Table/Table.jsx +++ b/frontend/src/Editor/Components/Table/Table.jsx @@ -563,65 +563,65 @@ export function Table({ const leftActionsCellData = leftActions().length > 0 ? [ - { - id: 'leftActions', - Header: 'Actions', - accessor: 'edit', - width: columnSizes.leftActions || defaultColumn.width, - Cell: (cell) => { - return leftActions().map((action) => ( - - )); + { + id: 'leftActions', + Header: 'Actions', + accessor: 'edit', + width: columnSizes.leftActions || defaultColumn.width, + Cell: (cell) => { + return leftActions().map((action) => ( + + )); + }, }, - }, - ] + ] : []; const rightActionsCellData = rightActions().length > 0 ? [ - { - id: 'rightActions', - Header: 'Actions', - accessor: 'edit', - width: columnSizes.rightActions || defaultColumn.width, - Cell: (cell) => { - return rightActions().map((action) => ( - - )); + { + id: 'rightActions', + Header: 'Actions', + accessor: 'edit', + width: columnSizes.rightActions || defaultColumn.width, + Cell: (cell) => { + return rightActions().map((action) => ( + + )); + }, }, - }, - ] + ] : []; const IndeterminateCheckbox = React.forwardRef(({ indeterminate, ...rest }, ref) => { @@ -665,7 +665,10 @@ export function Table({ ] // Hack: need to fix ); - const data = useMemo(() => tableData, [tableData.length, componentState.changeSet]); + const data = useMemo( + () => tableData, + [tableData.length, componentState.changeSet, component.definition.properties.data.value] + ); const computedStyles = { // width: `${width}px`, @@ -837,8 +840,9 @@ export function Table({ return ( { e.stopPropagation(); @@ -900,62 +904,62 @@ export function Table({ Object.keys(componentState.changeSet || {}).length > 0 || showFilterButton || showDownloadButton) && ( -
-
-
- {(clientSidePagination || serverSidePagination) && ( - - )} -
- - {showBulkUpdateActions && Object.keys(componentState.changeSet || {}).length > 0 && ( -
- - -
+
+
+
+ {(clientSidePagination || serverSidePagination) && ( + )} +
-
- {showFilterButton && ( - showFilters()}> - - {filters.length > 0 && ( - - )} - - )} - {showDownloadButton && ( - exportData('csv', true)} - > - - - )} + {showBulkUpdateActions && Object.keys(componentState.changeSet || {}).length > 0 && ( +
+ +
+ )} + +
+ {showFilterButton && ( + showFilters()}> + + {filters.length > 0 && ( + + )} + + )} + {showDownloadButton && ( + exportData('csv', true)} + > + + + )}
- )} +
+ )} {isFiltersVisible && (