Data flow
End-to-end lifecycle from structure load to row action refresh
Phase 1 — Structure load (feature page)
This happens on your page, before the table UI mounts.
Your Table.tsx page calls getTableStructure
useEffect runs with the load-table URL (e.g. categories, products).
useTableStructure fetches config
tableStructureLoading is true → GET via axiosTable → saves JSON in local state.
You render ReactApiTable
Pass table={tableStructure} and tableStructureLoading. Skeleton until loading is false.
ReactApiTable mounts the controller
ApiTables Redux starts; row data is not loaded yet.
useTableStructure keeps structure in local React state on the page — not in ApiTables Redux yet.
// Your page — Phase 1 only
const { getTableStructure, tableStructure, tableStructureLoading } = useTableStructure();
useEffect(() => {
getTableStructure({ table: '/api-table/control-tables/load-table/categories' });
}, []);
return (
<ReactApiTable table={tableStructure} tableStructureLoading={tableStructureLoading} />
);Phase 2 — Controller initialization
On table prop change (ApiTablesController):
_getTableComponents—tableName,structureColumns,structureFilters, optionalcustomElementstring id_getStructureBulkActions— bulk action definitions_getStructureRowActions— flattened if structure usesgeneral_actionsmulti-cell layout_checkActionsInRegularCells(true)when actions are keyed per column name_changePageSizefrom secure LS keyapi_tables_page_size
On unmount: _resetTableCore, _resetTableColumns, _resetTableBulkActions, _resetTableRowActions.
Phase 3 — Column binding
TableBody dispatches _setTableColumns with structureColumns and current tableData. formatTableColumns() in ./ApiTables/table-utils/utils.tsx produces react-data-table-component column defs with typed cell renderers.
Phase 4 — Data query
Fetch triggers when any of these change: tableName, currentPage, pageSize, appliedFilters, tableSorting, tableRefresher, pathname, or params prop.
AbortController cancels in-flight requests when dependencies change quickly.
Phase 5 — User interactions
| Interaction | Redux update | Next fetch? |
|---|---|---|
| Apply filters | _setAppliedFilters, _setRenderedFilters, _setCurrentPage(1) | Yes |
| Change sort (column header) | _setTableSorting | Yes |
| Change page / page size | _setCurrentPage / _changePageSize | Yes |
Row/bulk action success reload | _triggerTableReload | Yes |
| Toggle column visibility | _setVisibleColumns + LS | No |
| Select rows | _setSelectedRows | No |
Phase 6 — Row / bulk actions
Bulk actions use bulkActionsPostHandler with payload { filters: appliedFilters, selected_ids: selectedIds } unless a dedicated bulk modal opens first.
Refresh strategies
| Mechanism | Effect |
|---|---|
_triggerTableReload | Increments tableRefresher → refetch same page/filters |
_triggerOutscopeTableRefresher (global) | Remounts ApiTablesProvider → new table store |
refetchData / refetchRow | Updates rows without full reload |
See External state for when to remount vs reload.