From 9116631c4a98e45adc2342e15cba699949ef71be Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 5 Sep 2026 22:18:48 +0000 Subject: [PATCH] docs(core,react): the two @examples teaching getDataConfig read the shared record source (objectui#7798) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two doc blocks prescribed, in a copyable `@example`, a line no reader can write: const dataConfig = useMemo(() => getDataConfig(schema), [schema]); `packages/react/src/hooks/useNavigationOverlay.ts` (the `useNavigationOverlay` block) and `packages/core/src/utils/record-source.ts` (the `resolveRecordSourceObjectName` block) both spelled it that way, and `getDataConfig` is exported by nothing — measured, zero rows for `export function|const|{ getDataConfig` under `packages/`. It survives only as a file-local wrapper in `plugin-map/src/ObjectMap.tsx` and `plugin-grid/src/ObjectGrid.tsx`, so outside those two files there is no module to import it from. Both wrappers already delegate their ladder to `resolveRecordSourceConfig`, keeping only the array shorthand above the shared call, so all live sites now obtain this value the same way — `plugin-calendar` and `plugin-tree` call the shared producer directly. The examples follow those live call sites, which is the judgement PR #7797 applied to `navigation-overlay.tsx`: follow the live call sites, not another doc block. `useNavigationOverlay`'s example also names the import, so the line it teaches is copyable as written; `record-source.ts` needs none, and its example is now byte-identical to the `resolveRecordSourceConfig` example seventy lines below it in the same file. `scripts/check-doc-example-shared-reader.mjs` cannot see this class by construction — its condition (a) requires the example to call a symbol the repository exports, and `getDataConfig` is exported by nothing, so the pair is never formed. That gate is deliberately narrow and is left untouched; the fact is recorded on the card. No executable line changes: every added and removed diff line under `packages/` is a JSDoc continuation line, and both revisions of both files transpile to byte-identical output at `removeComments: true`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01KbJQ1y1J12nZxYzFWhP8Q3 --- .changeset/7798-getdataconfig-doc-example.md | 21 +++++++++++++++++++ packages/core/src/utils/record-source.ts | 2 +- .../react/src/hooks/useNavigationOverlay.ts | 7 ++++++- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .changeset/7798-getdataconfig-doc-example.md diff --git a/.changeset/7798-getdataconfig-doc-example.md b/.changeset/7798-getdataconfig-doc-example.md new file mode 100644 index 0000000000..c6676c92f3 --- /dev/null +++ b/.changeset/7798-getdataconfig-doc-example.md @@ -0,0 +1,21 @@ +--- +--- + +Point the two `@example` blocks that still taught `getDataConfig(schema)` at the +shared record-source producer `resolveRecordSourceConfig(schema)` from +`@object-ui/core` (objectui#7798): the `useNavigationOverlay` block in +`packages/react/src/hooks/useNavigationOverlay.ts` and the +`resolveRecordSourceObjectName` block in `packages/core/src/utils/record-source.ts`. + +`getDataConfig` is exported by nothing. It survives only as a file-local wrapper in +`plugin-map` and `plugin-grid` — and both of those already delegate their ladder to +`resolveRecordSourceConfig`, keeping only the array shorthand above it — so a reader +outside those two files could not write the line either example taught: there was no +module to import it from. The examples now spell `dataConfig` the way the live call +sites spell it (`plugin-calendar`, `plugin-tree`), which is the same judgement PR #7797 +applied to `navigation-overlay.tsx`: follow the live call sites, not another doc block. +The `useNavigationOverlay` example also names the import, so the line it teaches is +copyable as written. + +Doc comments only; no published behaviour changes and no package is released by this +change, so the frontmatter is empty. diff --git a/packages/core/src/utils/record-source.ts b/packages/core/src/utils/record-source.ts index e6baa3f66d..ca4e209a4e 100644 --- a/packages/core/src/utils/record-source.ts +++ b/packages/core/src/utils/record-source.ts @@ -68,7 +68,7 @@ import type { ViewData } from '@object-ui/types'; * * @example * ```ts - * const dataConfig = useMemo(() => getDataConfig(schema), [schema]); + * const dataConfig = useMemo(() => resolveRecordSourceConfig(schema), [schema]); * const objectName = resolveRecordSourceObjectName(schema, dataConfig); * ``` */ diff --git a/packages/react/src/hooks/useNavigationOverlay.ts b/packages/react/src/hooks/useNavigationOverlay.ts index 18ef67013d..00bb1307c9 100644 --- a/packages/react/src/hooks/useNavigationOverlay.ts +++ b/packages/react/src/hooks/useNavigationOverlay.ts @@ -210,7 +210,12 @@ export interface NavigationOverlayState { * * @example * ```tsx - * const dataConfig = useMemo(() => getDataConfig(schema), [schema]); + * import { + * resolveRecordSourceConfig, + * resolveRecordSourceObjectName, + * } from '@object-ui/core'; + * + * const dataConfig = useMemo(() => resolveRecordSourceConfig(schema), [schema]); * const { handleClick, isOpen, selectedRecord, mode, close, width } = * useNavigationOverlay({ * navigation: schema.navigation,