Skip to content

Commit 2978029

Browse files
committed
refactor(plugin-grid): keep getDataConfig file-local in ObjectGrid.tsx
Exported from objectGridQuery.ts, it became a shared reader for check:doc-example-readers, which then flagged the @example in core's record-source.ts. Left where it was, unexported, the gate reads the tree exactly as on main. Still move-only. Claude-Session: https://claude.ai/code/session_01Bdrd2yH4eqnz2QobtN3haE Co-authored-by: Claude <noreply@anthropic.com>
1 parent 48837b2 commit 2978029

2 files changed

Lines changed: 56 additions & 56 deletions

File tree

‎ui/packages/plugin-grid/src/ObjectGrid.tsx‎

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323

2424
import React, { useEffect, useState, useCallback, useMemo } from 'react';
25-
import type { ObjectGridSchema, DataSource, DependsOnInput, ListColumn, TableSortItem, DataTableSchema, ListViewExportFormat, RecordNavigateAction } from '@object-ui/types';
25+
import type { ObjectGridSchema, DataSource, DependsOnInput, ListColumn, ViewData, TableSortItem, DataTableSchema, ListViewExportFormat, RecordNavigateAction } from '@object-ui/types';
2626
import { isSystemManagedField, normalizeTableColumnType } from '@object-ui/types';
2727
import { parseFilterAST, resolveFieldScale, type FilterCondition } from '@objectstack/spec/data';
2828
import { SchemaRenderer, useDataScope, useNavigationOverlay, useAction, useSafeFieldLabel, usePredicateScope, useCapabilityGate, useDataInvalidation, notifyDataChanged, useFilterScope, useMetadata } from '@object-ui/react';
@@ -58,7 +58,7 @@ import {
5858
toast,
5959
} from '@object-ui/components';
6060
import { usePullToRefresh } from '@object-ui/mobile';
61-
import { resolveConditionalFormatting, resolveDependsOnFields, isDeadlineSettled, leadWithNameField, declaredNameField, buildExpandFields, buildExportFileName, columnIdentity, collectPredicateFieldRefs, collectGroupingFieldRefs, listViewPredicates, resolveAffordance, resolveFieldAffordance, type SchemaLike, isProjectableField, isExpandableFieldType, isUnmaterializedFieldType, readObjectSortability, isPlatformSortableField, filterPlatformSortableSort, toFilterNodeSafely, filterRefusalSubject, FilterOperatorError, convertSortToQueryParams, normalizeSortEntries, type QuerySortEntry, resolveRecordSourceObjectName, partitionRowsByPredicate, buildCategoryOrder, buildCategoryRank, toDisplayDate } from '@object-ui/core';
61+
import { resolveConditionalFormatting, resolveDependsOnFields, isDeadlineSettled, leadWithNameField, declaredNameField, buildExpandFields, buildExportFileName, columnIdentity, collectPredicateFieldRefs, collectGroupingFieldRefs, listViewPredicates, resolveAffordance, resolveFieldAffordance, type SchemaLike, isProjectableField, isExpandableFieldType, isUnmaterializedFieldType, readObjectSortability, isPlatformSortableField, filterPlatformSortableSort, toFilterNodeSafely, filterRefusalSubject, FilterOperatorError, convertSortToQueryParams, normalizeSortEntries, type QuerySortEntry, resolveRecordSourceConfig, resolveRecordSourceObjectName, partitionRowsByPredicate, buildCategoryOrder, buildCategoryRank, toDisplayDate } from '@object-ui/core';
6262
import { usePermissions } from '@object-ui/permissions';
6363
import {
6464
RECORD_OVERLAY_DEFAULT_WIDTH,
@@ -87,7 +87,7 @@ import { BulkActionBar } from './components/BulkActionBar';
8787
import { BulkActionDialog } from './components/BulkActionDialog';
8888
import type { BulkResult } from './hooks/useBulkExecutor';
8989
import type { BulkActionDef } from '@object-ui/types';
90-
import { findParamsSignature, getDataConfig, useResolvedGridFilters } from './objectGridQuery';
90+
import { findParamsSignature, useResolvedGridFilters } from './objectGridQuery';
9191
import { type ObjectGridColumn, type ObjectGridColumnDraft, isChipFieldType, normalizeColumns, resolveColumnLabel } from './objectGridColumns';
9292
import { LinkCell, recordPointerFace, rowRecordId } from './objectGridLinkCell';
9393
import { useGridTranslation } from './objectGridTranslations';
@@ -463,6 +463,55 @@ export interface ObjectGridComponentProps extends ObjectGridExternalPaginationPr
463463
onAddRecord?: () => void;
464464
}
465465

466+
/**
467+
* Helper to get data configuration from schema.
468+
*
469+
* The ruled three-rung ladder itself (`data`, then `staticData`, then
470+
* `objectName`) is `resolveRecordSourceConfig` in `@object-ui/core` — ONE
471+
* implementation of a contract published on both faces (`77cb489b4`), which
472+
* this file used to hand-copy (`ce2aaefe1`).
473+
*
474+
* What used to stay here was the head above it: the bare-array `data`
475+
* shorthand, which lifted `data: [...]` to `{ provider: 'value', items }`.
476+
* ⛔ IT IS GONE (objectui#8348, decision batch #83, maintainer verbatim
477+
* 「8348 以协议为准」 — the contract decides).
478+
*
479+
* MEASURED on `@objectstack/spec` 17.4.0:
480+
* `ComponentPropsMap['object-grid'].data` is the `ViewData` union, and its own
481+
* description names the refusal — *"Static inline rows live at
482+
* `{ provider: 'value', items: [...] }`; the bare-array shortcut is refused —
483+
* see migration `object-grid-data-view-data-converged`"*. This block's own
484+
* registration publishes the same arm (`{ name: 'data', type: 'object' }` in
485+
* `index.tsx`), and `gridDataInputContract.test.ts` has pinned that declaration
486+
* since objectui#5090. The head was the last carrier of a spelling every one of
487+
* those faces refuses, so `data` is honoured here on the OBJECT arm only and
488+
* the shared rung is passed `'view-data'`.
489+
*
490+
* ⛔ WHAT THIS REACHES, measured per CARRIER — do NOT read it as "the array is
491+
* gone". An authored `data` array reaches this component TWICE: as
492+
* `schema.data`, which this function used to lift, and as the `data` PROP,
493+
* because `SchemaRenderer` spreads every non-metadata node key and
494+
* `index.tsx` forwards `{...rest}`. That prop is `passedData` below, and it
495+
* lifts an array to `{ provider: 'value', items }` at HIGHER priority than this
496+
* ladder — it is the channel a host such as `ListView` uses to hand down rows it
497+
* already fetched, and it is indistinguishable here from an authored key.
498+
*
499+
* ⇒ at the ladder the array is no longer a record source; through
500+
* `SchemaRenderer` an authored `data: [ …rows… ]` still draws, from the props
501+
* channel. Both halves are pinned in
502+
* `__tests__/gridBareArrayDataRefused-8348.test.tsx`, which had to correct its
503+
* own first draft on exactly this point. Collapsing the two carriers would take
504+
* the host path with it and is outside objectui#8348's scope — reported on the
505+
* card, not changed in passing.
506+
*
507+
* The declared spelling for inline rows is
508+
* `data: { provider: 'value', items: [...] }`, and the deprecated `staticData`
509+
* array still works as before.
510+
*/
511+
function getDataConfig(schema: ObjectGridSchema): ViewData | null {
512+
return resolveRecordSourceConfig(schema, 'view-data');
513+
}
514+
466515
/**
467516
* The relational copy set and `applyRelationalMeta` moved to
468517
* `./relationalMetaKeys` for objectui#6875. The list there is DERIVED from a

‎ui/packages/plugin-grid/src/objectGridQuery.ts‎

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/**
22
* The query helpers of `ObjectGrid` (`./ObjectGrid.tsx`): the held resolution
3-
* of the node's own filter, the record-source ladder and the find-params
4-
* signature, moved out of that file verbatim (objectstack#25994, slice 1).
3+
* of the node's own filter and the find-params signature, moved out of that
4+
* file verbatim (objectstack#25994, slice 1).
55
*/
66

77
import { useState } from 'react';
8-
import type { ObjectGridSchema, ViewData } from '@object-ui/types';
8+
import type { ObjectGridSchema } from '@object-ui/types';
99
import { isSameAuthoredFilter } from '@object-ui/react';
10-
import { resolveRecordSourceConfig, resolveFilterPlaceholders, type FilterTokenScope } from '@object-ui/core';
10+
import { resolveFilterPlaceholders, type FilterTokenScope } from '@object-ui/core';
1111

1212
/**
1313
* The node's own authored filter: the canonical `filter`. Its deprecated alias
@@ -83,55 +83,6 @@ export function useResolvedGridFilters(authored: AuthoredGridFilters, scope: Fil
8383
return held.resolved;
8484
}
8585

86-
/**
87-
* Helper to get data configuration from schema.
88-
*
89-
* The ruled three-rung ladder itself (`data`, then `staticData`, then
90-
* `objectName`) is `resolveRecordSourceConfig` in `@object-ui/core` — ONE
91-
* implementation of a contract published on both faces (`77cb489b4`), which
92-
* this file used to hand-copy (`ce2aaefe1`).
93-
*
94-
* What used to stay here was the head above it: the bare-array `data`
95-
* shorthand, which lifted `data: [...]` to `{ provider: 'value', items }`.
96-
* ⛔ IT IS GONE (objectui#8348, decision batch #83, maintainer verbatim
97-
* 「8348 以协议为准」 — the contract decides).
98-
*
99-
* MEASURED on `@objectstack/spec` 17.4.0:
100-
* `ComponentPropsMap['object-grid'].data` is the `ViewData` union, and its own
101-
* description names the refusal — *"Static inline rows live at
102-
* `{ provider: 'value', items: [...] }`; the bare-array shortcut is refused —
103-
* see migration `object-grid-data-view-data-converged`"*. This block's own
104-
* registration publishes the same arm (`{ name: 'data', type: 'object' }` in
105-
* `index.tsx`), and `gridDataInputContract.test.ts` has pinned that declaration
106-
* since objectui#5090. The head was the last carrier of a spelling every one of
107-
* those faces refuses, so `data` is honoured here on the OBJECT arm only and
108-
* the shared rung is passed `'view-data'`.
109-
*
110-
* ⛔ WHAT THIS REACHES, measured per CARRIER — do NOT read it as "the array is
111-
* gone". An authored `data` array reaches this component TWICE: as
112-
* `schema.data`, which this function used to lift, and as the `data` PROP,
113-
* because `SchemaRenderer` spreads every non-metadata node key and
114-
* `index.tsx` forwards `{...rest}`. That prop is `passedData` below, and it
115-
* lifts an array to `{ provider: 'value', items }` at HIGHER priority than this
116-
* ladder — it is the channel a host such as `ListView` uses to hand down rows it
117-
* already fetched, and it is indistinguishable here from an authored key.
118-
*
119-
* ⇒ at the ladder the array is no longer a record source; through
120-
* `SchemaRenderer` an authored `data: [ …rows… ]` still draws, from the props
121-
* channel. Both halves are pinned in
122-
* `__tests__/gridBareArrayDataRefused-8348.test.tsx`, which had to correct its
123-
* own first draft on exactly this point. Collapsing the two carriers would take
124-
* the host path with it and is outside objectui#8348's scope — reported on the
125-
* card, not changed in passing.
126-
*
127-
* The declared spelling for inline rows is
128-
* `data: { provider: 'value', items: [...] }`, and the deprecated `staticData`
129-
* array still works as before.
130-
*/
131-
export function getDataConfig(schema: ObjectGridSchema): ViewData | null {
132-
return resolveRecordSourceConfig(schema, 'view-data');
133-
}
134-
13586
/**
13687
* Content signature of a host's find-params, used as the query-change signal for
13788
* the cross-page escalation (objectui#4501 clause 2).

0 commit comments

Comments
 (0)