Remove unused components (#1180)
* Remove unused components * Fix company not being created issue * Fix company not being created issue * Fix company not being created issue * Optimize rendering * Optimize rendering
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { PeopleTable } from '@/people/table/components/PeopleTable';
|
||||
@ -9,8 +8,9 @@ import { TableActionBarButtonDeletePeople } from '@/people/table/components/Tabl
|
||||
import { IconUser } from '@/ui/icon';
|
||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
||||
import { useUpsertEntityTableItem } from '@/ui/table/hooks/useUpsertEntityTableItem';
|
||||
import { useUpsertTableRowId } from '@/ui/table/hooks/useUpsertTableRowId';
|
||||
import { TableContext } from '@/ui/table/states/TableContext';
|
||||
import { tableRowIdsState } from '@/ui/table/states/tableRowIdsState';
|
||||
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
|
||||
import { useInsertOnePersonMutation } from '~/generated/graphql';
|
||||
|
||||
@ -21,7 +21,8 @@ const StyledTableContainer = styled.div`
|
||||
|
||||
export function People() {
|
||||
const [insertOnePerson] = useInsertOnePersonMutation();
|
||||
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
|
||||
const upsertEntityTableItem = useUpsertEntityTableItem();
|
||||
const upsertTableRowIds = useUpsertTableRowId();
|
||||
|
||||
async function handleAddButtonClick() {
|
||||
const newPersonId: string = v4();
|
||||
@ -45,8 +46,10 @@ export function People() {
|
||||
},
|
||||
},
|
||||
update: (cache, { data }) => {
|
||||
data?.createOnePerson?.id &&
|
||||
setTableRowIds([data?.createOnePerson.id, ...tableRowIds]);
|
||||
if (data?.createOnePerson) {
|
||||
upsertTableRowIds(data?.createOnePerson.id);
|
||||
upsertEntityTableItem(data?.createOnePerson);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user