From d896f9a0d9845468ea204ba80bd3b9b3e1c97dad Mon Sep 17 00:00:00 2001 From: "Roger Tuan (DatoCMS)" Date: Tue, 19 May 2026 15:35:20 -0700 Subject: [PATCH] Move stega util exports out of custom client hook --- src/index.ts | 5 +++++ src/useContentLink/index.ts | 8 ++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8ee53e7..cab3c4e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,3 +10,8 @@ export * from './useVideoPlayer/index.js'; export * from './ContentLink/index.js'; export * from './useContentLink/index.js'; + +// Re-export types and utilities from @datocms/content-link for convenience +// Do NOT put these in a 'use client' component or custom hook or they won't run in RSCs correctly +export { decodeStega, revealStega, stripStega } from '@datocms/content-link'; +export type { Controller } from '@datocms/content-link'; diff --git a/src/useContentLink/index.ts b/src/useContentLink/index.ts index 3cc40ee..4477654 100644 --- a/src/useContentLink/index.ts +++ b/src/useContentLink/index.ts @@ -1,11 +1,7 @@ 'use client'; import { type Controller, createController } from '@datocms/content-link'; -import { useCallback, useEffect, useRef } from 'react'; - -// Re-export types and utilities from @datocms/content-link for convenience -export { decodeStega, revealStega, stripStega } from '@datocms/content-link'; -export type { Controller } from '@datocms/content-link'; +import { type RefObject, useCallback, useEffect, useRef } from 'react'; export type UseContentLinkOptions = { /** @@ -26,7 +22,7 @@ export type UseContentLinkOptions = { /** Callback when Web Previews plugin requests navigation */ onNavigateTo?: (path: string) => void; /** Ref to limit scanning to this root instead of document */ - root?: React.RefObject; + root?: RefObject; /** * Hue (0–359) of the overlay accent color. * @default 17 (orange)