Fix/table remove and mock data (#653)
* Removed tanstack react table * Fixed remove table feature without tanstack table * Fixed delete people and companies * Fixed hotkeys on editable date cell * Fixed double text * Fixed company mock mode * Fixed lint * Fixed right click selection
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useRecoilState } from 'recoil';
|
||||
|
||||
import { isFetchingEntityTableDataState } from '@/ui/tables/states/isFetchingEntityTableDataState';
|
||||
import { tableRowIdsState } from '@/ui/tables/states/tableRowIdsState';
|
||||
import { mockedCompaniesData } from '~/testing/mock-data/companies';
|
||||
|
||||
import { useSetCompanyEntityTable } from '../hooks/useSetCompanyEntityTable';
|
||||
|
||||
export function CompanyEntityTableDataMocked() {
|
||||
const [, setTableRowIds] = useRecoilState(tableRowIdsState);
|
||||
|
||||
const [, setIsFetchingEntityTableData] = useRecoilState(
|
||||
isFetchingEntityTableDataState,
|
||||
);
|
||||
|
||||
const setCompanyEntityTable = useSetCompanyEntityTable();
|
||||
|
||||
useEffect(() => {
|
||||
const companyIds = mockedCompaniesData.map((company) => company.id);
|
||||
|
||||
setTableRowIds((currentRowIds) => {
|
||||
if (JSON.stringify(currentRowIds) !== JSON.stringify(companyIds)) {
|
||||
return companyIds;
|
||||
}
|
||||
|
||||
return currentRowIds;
|
||||
});
|
||||
|
||||
setCompanyEntityTable(mockedCompaniesData);
|
||||
|
||||
setIsFetchingEntityTableData(false);
|
||||
}, [setCompanyEntityTable, setIsFetchingEntityTableData, setTableRowIds]);
|
||||
|
||||
return <></>;
|
||||
}
|
||||
Reference in New Issue
Block a user