2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

Add useTable hook (#6000)

* Add new hook - useTable

- Will replace useTableRefresh
- More extensible (further functionality to follow)
- Pass entire state through to final table
- Defined interface for return type

* Update BomTable

* Update UsedInTable

* Refactor attachment table

* Update remaining tables

* Clean StockItemTable

* Fix NotificationTable

* Remove unused import
This commit is contained in:
Oliver
2023-11-28 23:15:08 +11:00
committed by GitHub
parent c7bf1348e7
commit c3aeadda4a
28 changed files with 160 additions and 168 deletions

View File

@ -5,7 +5,7 @@ import { useNavigate } from 'react-router-dom';
import { ApiPaths } from '../../../enums/ApiEndpoints';
import { shortenString } from '../../../functions/tables';
import { useTableRefresh } from '../../../hooks/TableRefresh';
import { useTable } from '../../../hooks/UseTable';
import { apiUrl } from '../../../states/ApiState';
import { Thumbnail } from '../../images/Thumbnail';
import { TableColumn } from '../Column';
@ -265,14 +265,14 @@ export function PartListTable({ props }: { props: InvenTreeTableProps }) {
const tableColumns = useMemo(() => partTableColumns(), []);
const tableFilters = useMemo(() => partTableFilters(), []);
const { tableKey, refreshTable } = useTableRefresh('part');
const table = useTable('part-list');
const navigate = useNavigate();
return (
<InvenTreeTable
url={apiUrl(ApiPaths.part_list)}
tableKey={tableKey}
tableState={table}
columns={tableColumns}
props={{
...props,