diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index 136b8303..a5637618 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -48,6 +48,15 @@ const Table: ForwardRefRenderFunction = (props, ref) => { dispatch({ type: Actions.rowsChanged, payload: rows }); }, [rows]); + useEffect(() => { + const newSorting = { + column: sorting?.column, + isDescending: sorting?.isDescending, + }; + + dispatch({ type: Actions.sortingChanged, payload: newSorting }); + }, [sorting]); + useEffect(() => { onRowSelect && onRowSelect(selected); }, [selected]); diff --git a/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap b/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap index 7f97e557..4f16b8a4 100644 --- a/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +++ b/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap @@ -21,6 +21,14 @@ exports[` matches snapshot 1`] = ` Header1 + + +
matches snapshot 1`] = ` Header2 + + + matches snapshot 1`] = ` Header3 + + + matches snapshot 1`] = ` Header4 + + + matches snapshot 1`] = ` Header5 + + +