Move code to a lib, remove table dependancy (#606)

* Move code to a lib, remove table dependancy

* Abstract yable context from filters

* Update missing hook

* Remove wording of active filter, simplify naming for edited filters

* lint
This commit is contained in:
Emilien Chauvet
2023-07-11 17:05:08 -07:00
committed by GitHub
parent 4150a7bb51
commit e8d77833a7
59 changed files with 262 additions and 298 deletions

View File

@ -6,9 +6,9 @@ import {
defaultOrderBy,
useCompaniesQuery,
} from '@/companies/services';
import { reduceSortsToOrderBy } from '@/filters-and-sorts/helpers';
import { activeTableFiltersScopedState } from '@/filters-and-sorts/states/activeTableFiltersScopedState';
import { turnFilterIntoWhereClause } from '@/filters-and-sorts/utils/turnFilterIntoWhereClause';
import { reduceSortsToOrderBy } from '@/lib/filters-and-sorts/helpers';
import { filtersScopedState } from '@/lib/filters-and-sorts/states/filtersScopedState';
import { turnFilterIntoWhereClause } from '@/lib/filters-and-sorts/utils/turnFilterIntoWhereClause';
import { useRecoilScopedValue } from '@/recoil-scope/hooks/useRecoilScopedValue';
import { EntityTable } from '@/ui/components/table/EntityTable';
import { HooksEntityTable } from '@/ui/components/table/HooksEntityTable';
@ -27,10 +27,7 @@ export function CompanyTable() {
setOrderBy(sorts.length ? reduceSortsToOrderBy(sorts) : defaultOrderBy);
}, []);
const filters = useRecoilScopedValue(
activeTableFiltersScopedState,
TableContext,
);
const filters = useRecoilScopedValue(filtersScopedState, TableContext);
const whereFilters = useMemo(() => {
if (!filters.length) return undefined;