Files
twenty/front/src/modules/people/components/PeopleEntityTableDataEffect.tsx
T
84a27b148f Feat/sidecar components (#1578)
* Added a new eslint plugin in TypeScript for Effect components

* Fixed edge cases

* Fixed lint

* Fix eslint

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2023-09-14 17:04:45 -07:00

33 lines
658 B
TypeScript

import {
PersonOrderByWithRelationInput,
SortOrder,
useGetPeopleQuery,
} from '~/generated/graphql';
import { useSetPeopleEntityTable } from '../hooks/useSetPeopleEntityTable';
export function PeopleEntityTableDataEffect({
orderBy = [
{
createdAt: SortOrder.Desc,
},
],
whereFilters,
}: {
orderBy?: PersonOrderByWithRelationInput[];
whereFilters?: any;
}) {
const setPeopleEntityTable = useSetPeopleEntityTable();
useGetPeopleQuery({
variables: { orderBy, where: whereFilters },
onCompleted: (data) => {
const people = data.people ?? [];
setPeopleEntityTable(people);
},
});
return <></>;
}