updates the exposed vars (#4426)

This commit is contained in:
Arpit 2022-10-14 13:44:50 +05:30 committed by GitHub
parent ceed17a0a7
commit b36461b161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -427,20 +427,20 @@ export function Table({
const columnName = columns.find((column) => column.id === state?.sortBy?.[0]?.id).accessor;
return {
sortedBy: {
return [
{
column: columnName,
direction: state?.sortBy?.[0]?.desc ? 'desc' : 'asc',
},
};
];
}, [JSON.stringify(state)]);
useEffect(() => {
if (!sortOptions) {
setExposedVariable('sortedBy', null);
setExposedVariable('sortApplied', []);
return;
}
setExposedVariable('sortedBy', sortOptions.sortedBy).then(() => fireEvent('onSort'));
setExposedVariable('sortApplied', sortOptions).then(() => fireEvent('onSort'));
}, [sortOptions]);
registerAction(