Feat/metadata with datatable v2 (#2110)
* Reworked metadata creation * Wip * Fix from PR * Removed consolelog * Post merge * Fixed seeds * Wip * Added dynamic routing --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -12,25 +12,24 @@ import { useRecoilScopeId } from '@/ui/utilities/recoil-scope/hooks/useRecoilSco
|
||||
|
||||
import { useFindManyObjects } from '../hooks/useFindManyObjects';
|
||||
import { useSetObjectDataTableData } from '../hooks/useSetDataTableData';
|
||||
import { MetadataObjectIdentifier } from '../types/MetadataObjectIdentifier';
|
||||
|
||||
export type ObjectDataTableEffectProps = MetadataObjectIdentifier;
|
||||
|
||||
export const ObjectDataTableEffect = ({
|
||||
objectNameSingular,
|
||||
objectNamePlural,
|
||||
}: {
|
||||
objectNamePlural: string;
|
||||
objectNameSingular: string;
|
||||
}) => {
|
||||
}: ObjectDataTableEffectProps) => {
|
||||
const setDataTableData = useSetObjectDataTableData();
|
||||
|
||||
const { objects } = useFindManyObjects({
|
||||
objectNamePlural: objectNamePlural,
|
||||
objectNamePlural,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const entities = objects ?? [];
|
||||
|
||||
setDataTableData(entities);
|
||||
}, [objects, objectNameSingular, setDataTableData]);
|
||||
}, [objects, setDataTableData]);
|
||||
|
||||
const [searchParams] = useSearchParams();
|
||||
const tableRecoilScopeId = useRecoilScopeId(TableRecoilScopeContext);
|
||||
|
||||
Reference in New Issue
Block a user