Architecture overview

Layers, responsibilities, and design constraints in ApiTables

This page maps how frontend pieces connect. Read Key concepts first if you are new.

ApiTables splits configuration (from the API), state (per-table Redux), data fetching (hooks + axios), and presentation (./ApiTables/core/ + ./ApiTables/general-components/). Feature pages only fetch structure and render ReactApiTable — they do not define columns.

Who reads this?

ReaderFocus on
JuniorComponent table below + "Two Redux worlds"
MidLayer diagram + API contracts
SeniorDesign constraints + directory roles

Layer diagram

Component responsibilities

ComponentFileResponsibility
ReactApiTable./ApiTables/ReactApiTable.tsxProvider wrapper, loading gate, default controller
ApiTablesProvider./ApiTables/ApiTablesProvider.tsxIsolated Redux; remount key from global app slice
ApiTablesController./ApiTables/ApiTablesController.tsxHydrate slices from structure; orchestrate fetches
ApiTablesComponent./ApiTables/ApiTablesComponent.tsxCompose toolbar + table + modals mount point
ApiTablesModals./ApiTables/table-modals/ApiTablesModals.tsxCentral modal router (row, bulk, column, custom)

Two Redux worlds

StoreScopeAccess
Table storeOne per ApiTablesProvideruseSelector inside table subtree
App storeWhole bolesa-app-uigetExternalState(), store from @/store/store, or useSelector on state.app in provider

Table state must not leak between tables on the same page — hence createTableStore() per provider.

API contracts

PhaseMethodPath pattern
StructureGET/api-table/control-tables/load-table/{name} (path varies per feature)
DataPOST/api-table/control-tables/query-table/{tableName}
Row/bulk actionPOST/PUT/…Action URL from structure (often /api/..., stripped to path in client)

Query body shape:

{
  "perPage": 25,
  "page": 1,
  "filters": { },
  "sorts": { },
  "params": { }
}

filters is the object form from _setAppliedFilters (keyed by filter name). sorts is tableSorting from Redux.

Directory roles

PathRole
./ApiTables/core/Interactive table UI (filters, sort badge, body, pagination)
./ApiTables/general-components/Cell renderers and row action buttons
./ApiTables/table-providers/Store factory, slices, useUtilsProvider
./ApiTables/table-modals/Modals + custom-controls/ feature forms
./ApiTables/hooks/Structure fetch (local state) and data fetch
./ApiTables/table-utils/Column formatting, filter normalization, downloads

Design constraints

  1. Custom controls are not auto-discovered — each API URL is matched manually in ApiTablesModals.tsx.
  2. Sorting is server-sidereact-data-table-component calls onSort; Redux holds sorts for the query.
  3. Selection clears on every data fetchuseTableFetcher toggles toggledClearRows and clears selectedRows.
  4. Column visibility persists in secure local storage under {tableName}_tb.

On this page