import React, { useState } from 'react'; import { observer } from 'mobx-react-lite'; import { CollectionState, FiltersMap } from '@wix/bex-core'; import { TableV2 } from './TableV2'; import { TableState } from '../../state'; import { useWixPatternsContainer } from '@wix/bex-core/react'; import { CollectionTableBaseProps } from '../CollectionTable'; import type { TableSectionsProp } from '../TableSections'; export interface TableCompatProps extends CollectionTableBaseProps { /** * A collection state instance created with [useCollection](./?path=/story/common-hooks--usecollection) * @external */ state: CollectionState | TableState; sections?: TableSectionsProp; } function _TableCompat( props: TableCompatProps, ) { const container = useWixPatternsContainer(); const [state] = useState(() => props.state instanceof TableState ? props.state : new TableState({ collection: props.state, container, }), ); return ; } export const TableCompat = observer(_TableCompat);