2357 Refactor RecordTable to use the new scope architecture (#2407)
* create RecordTableScope * use RecordTableScope * working on useRecordTable hook * add RecordTableScope to company-table * add RecordTableScope to person-table * add filter state and sort state * add useSetRecordTableData to useRecordTable * wip * add setRecordTableData to useRecordTable * update in RecordTableEffect * fix bug * getting rid of unnecessary context and hooks * remove console.log * wip * fix bug by creating an init effect * fix viewbar not in scope in company and people tables * wip * updating useRecordTable to use internal hooks * updating useRecordTable to use internal hooks * updating useRecordTable to use internal hooks * updating useRecordTable to use internal hooks * modified according to comments
This commit is contained in:
@ -1,10 +1,7 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { peopleAvailableFieldDefinitions } from '@/people/constants/peopleAvailableFieldDefinitions';
|
||||
import { availableTableColumnsScopedState } from '@/ui/object/record-table/states/availableTableColumnsScopedState';
|
||||
import { TableRecoilScopeContext } from '@/ui/object/record-table/states/recoil-scope-contexts/TableRecoilScopeContext';
|
||||
import { tableColumnsScopedState } from '@/ui/object/record-table/states/tableColumnsScopedState';
|
||||
import { useRecoilScopedState } from '@/ui/utilities/recoil-scope/hooks/useRecoilScopedState';
|
||||
import { useRecordTable } from '@/ui/object/record-table/hooks/useRecordTable';
|
||||
import { useView } from '@/views/hooks/useView';
|
||||
import { ViewType } from '@/views/types/ViewType';
|
||||
import { personTableFilterDefinitions } from '~/pages/people/constants/personTableFilterDefinitions';
|
||||
@ -19,15 +16,7 @@ const PeopleTableEffect = () => {
|
||||
setViewObjectId,
|
||||
} = useView();
|
||||
|
||||
const [, setTableColumns] = useRecoilScopedState(
|
||||
tableColumnsScopedState,
|
||||
TableRecoilScopeContext,
|
||||
);
|
||||
|
||||
const [, setAvailableTableColumns] = useRecoilScopedState(
|
||||
availableTableColumnsScopedState,
|
||||
TableRecoilScopeContext,
|
||||
);
|
||||
const { setAvailableTableColumns, setTableColumns } = useRecordTable();
|
||||
|
||||
useEffect(() => {
|
||||
setAvailableSortDefinitions?.(personTableSortDefinitions);
|
||||
|
||||
Reference in New Issue
Block a user