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,