Skip to content

Filter to Query to Select Data Flow Guide ​

This guide explains the list-page data path from filter UI into query state, then into ModelResource.select(query), and finally into table and pager state in Zova.

Use this page when you want to understand:

  • how filter UI changes become list-page query state
  • how paging state joins that query
  • how the final query reaches ModelResource.select(query)
  • how the resulting paged/list data is consumed by table and pager
  • where permission-driven table-meta refresh sits relative to that data flow

Why this page exists ​

Several existing docs already explain nearby pieces:

What those pages do not isolate directly is the one compact data-flow path from filter UI into the owner-side query execution boundary.

That is the gap this page fills.

The shortest accurate mental model ​

A practical mental model is:

  1. blockFilter normalizes user-entered filter values
  2. blockPage stores those values in queryFilterData
  3. blockPage also owns paging state in queryPaged
  4. blockPage composes fixed predicates, user filters, structured orders and paging into one query
  5. ModelResource.select(query) becomes the owner-side query execution boundary
  6. the select result provides both list and paged metadata
  7. blockTable consumes the list data
  8. blockPager consumes the paged metadata

That means the list-page fetch path is not scattered across table, pager, and filter. It is centralized in the page runtime and then handed to the owner.

Source-confirmed reading path ​

When reading this topic, use this order:

  1. zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPage/controller.tsx
  2. zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockFilter/controller.tsx
  3. zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPager/controller.tsx
  4. zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockTable/controller.tsx
  5. zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts

That order moves from the page-owned state source, to filter and pager inputs, to the table bridge, and finally to the owner-side query execution path.

Runtime path by layer ​

1. Filter UI becomes queryFilterData ​

The filter bridge lives in:

text
zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockFilter/controller.tsx

This block renders ZForm with:

  • data={$$page.queryFilterData}
  • schema={$$page.schemaFilter}
  • schemaScene="filter"

Its submit and reset flow both pass through _onFilter(dataOld).

The important source-confirmed behavior is:

  • nil and empty-string values are removed
  • the normalized object is passed to $$page.onFilter(dataNew)

This is the first key rule:

  • blockFilter does not fetch directly
  • it normalizes filter values and pushes them into page-owned state

2. Paging state becomes queryPaged ​

The page runtime owner lives in:

text
zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPage/controller.tsx

Inside __init__(), it initializes:

  • queryFilterData = {}
  • queryPaged = { pageNo: 1, pageSize: this.$props.pageSize }

It also owns:

  • gotoPage(pageNo)
  • setPageSize(pageSize)

That means paging is page-owned runtime state, not something the pager block owns independently.

3. query composes constraints and list controls ​

blockPage owns queryFixedData, queryFilterData, querySortingData and queryPaged. Its query getter separates predicates before merging other controls:

typescript
const { where: whereFixed, ...queryFixed } = this.queryFixedData;
const { where: whereFilter, ...queryFilter } = this.queryFilterData;
const predicates = [whereFixed, whereFilter].filter(
  (where): where is NonNullable<ITableQuery['where']> => !!where,
);
const where = predicates.length > 1 ? { and: predicates } : predicates[0];
return {
  ...queryFixed,
  ...queryFilter,
  ...this.querySortingData,
  ...(where ? { where } : {}),
  ...this.queryPaged,
};

where is the canonical public predicate AST, not a property-keyed ORM object. Fixed and user predicates combine by AND, preserving repeated fields and nested OR/NOT. Do not spread one where object over another. If neither exists, omit where; do not send {}. Named form fields remain top-level conveniences and the backend AND-composes their normalized predicates with explicit where.

For a policy admitting the field, a resource-picker fixed constraint can be:

typescript
const queryFixed = {
  where: { field: 'level', op: 'eq', value: 2 },
};

This frontend fixed query is a UX constraint, not authorization. The Resource controller uses $compileQuery to validate the public query and compose the current Action's trusted RBAC row restriction (scopeWhere: rbacScopeCurrent.where()) AND the canonical client predicate; never pass the AST to rbacScopeCurrent.where(params.where). Its service accepts trusted ORM parameters without recompilation and retains business authorization and additional ownership/state/visibility rules. Normal Model instance/soft-delete scope remains active. Dedicated self-service methods with explicit identity and business scope may still own compilation; see Public Query Guide. There is no public raw-ORM fallback, even for handwritten clients or pickers.

Sorting changes produce structured controls, for example:

typescript
{
  orders: [{ field: 'createdAt', direction: 'desc' }];
}

Do not emit tuple orders or infer sortability from a same-named filter input. schemaOrder exposes backend public order capabilities; response column rest.enableSorting remains the UI enablement gate. A field may be sortable without a named filter. The Basic table emits one user sort; the backend supplies endpoint defaults when omitted and a stable resource-id tie-breaker when absent. Named filters, canonical predicate fields, orderable fields and returned columns are distinct capabilities. Current fixed projection rejects client columns.

Fixed-query, filter and sort changes reset page 1 and clear ordinary list selection; page-size changes do likewise. Picker-persistent selection follows the existing selection policy rather than being unconditionally cleared. Filter and paging state stay separate while edited; the composed query is the one passed to the existing resource owner, not a second fetch/cache owner.

4. ModelResource.select(query) is the owner-side query boundary ​

The owner-side boundary lives in:

text
zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts

blockPage uses:

typescript
get queryData() {
  return this.$$modelResource.selectGeneral(this.$props.actionPath, this.query);
}

Inside the owner:

  • select(query?) delegates to selectGeneral(undefined, query)
  • selectGeneral(...) creates a query key shaped like:
    • ['select', 'public-query-v1', actionPath ?? '', hashkey(query)]
  • it fetches the list result from the resolved resourceApi
  • the contract discriminator prevents old persisted raw-query results from masquerading as new-contract results; existing select-prefix invalidation remains in use

This is the second key rule:

  • pages assemble query state
  • ModelResource owns query execution, query-key identity, and fetch semantics

5. The select result becomes both data and paged ​

Back in blockPage, two important derived surfaces are exposed:

  • data = queryData.data?.list
  • paged = queryData.data

This matters because the select result is not only a list.

It is the paged result surface that both table and pager depend on.

6. blockTable consumes list data ​

The table bridge lives in:

text
zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockTable/controller.tsx

It consumes the shared page runtime and passes into ZTable:

  • data={$$page.data}
  • schema={$$page.schemaRow}
  • tableScope={$$page.jsxCelScope}

That means blockTable is not the owner of the fetch path.

It is the bridge from page-owned list result into the table runtime.

7. blockPager consumes paged metadata ​

The pager block lives in:

text
zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPager/controller.tsx

It reads:

  • $$page.paged

and delegates navigation back into page-owned state with:

  • $$page.gotoPage(...)

This is the third key rule:

  • the pager does not fetch directly
  • it mutates page-owned paging state and lets the central query path react

Keep schemaFilter, schemaOrder and schemaRow under the current resource owner. They are locale-reactive: reacquire current schema facades rather than retaining a snapshot from before a locale change. Advanced-query typing comes from backend policy/OpenAPI generation; the named ZForm does not need to become an advanced query editor.

Permission-driven table-meta refresh is adjacent, not the data path itself ​

blockPage also watches:

  • permissions

and refreshes table meta when permission state changes.

That behavior is important, but it is not the same thing as the filter/query/select data path.

A practical rule is:

  • filter/paging changes affect query identity and data fetches
  • permission changes affect table metadata and visible action/column behavior

Those are related, but distinct, flows.

A compact end-to-end trace ​

The shortest end-to-end trace is:

  • filter UI normalizes user input
  • queryFilterData changes
  • queryPaged changes when navigation changes page
  • fixed and user AST predicates compose with AND; other filter/sort/page controls join the query
  • queryData = $$modelResource.selectGeneral(actionPath, query)
  • data = queryData.data?.list
  • paged = queryData.data
  • table consumes data
  • pager consumes paged

That is the source-confirmed filter -> query -> select data path in the current Basic list-page runtime.

Debugging checklist ​

If list data looks wrong, ask:

  1. did blockFilter normalize away a field unexpectedly?
  2. did queryFilterData actually change?
  3. did queryPaged change as expected?
  4. does the composed query contain the expected named controls, AND-composed AST and structured orders, without an empty where?
  5. did ModelResource.select(query) create the expected query-key identity?
  6. is queryData.data?.list populated as expected?
  7. is paged present and consistent with the list result?
  8. is the issue really data flow, or is it permission-driven table-meta refresh instead?

Use these next steps depending on your question:

Final takeaway ​

The most accurate way to read the current Basic list-page data path is:

  • blockFilter owns filter normalization
  • blockPage owns query state assembly
  • ModelResource.select(query) owns owner-side query execution
  • data and paged are the shared outputs
  • table and pager consume those outputs instead of owning the fetch logic

That is the source-confirmed filter -> query -> select runtime path in the current Cabloy Basic frontend architecture.

Released under the MIT License.