From 9d20ee508d3eb211dcd3a5ea7f1b5916cdf13ccf Mon Sep 17 00:00:00 2001 From: Bieber Date: Sat, 21 Mar 2026 00:09:24 +0800 Subject: [PATCH] [sync] fix: share view and template call unnecessary api (#1484) (#2793) Synced from teableio/teable-ee@9c0fd6f Co-authored-by: Aries X --- apps/nextjs-app/src/features/app/hooks/useAI.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/nextjs-app/src/features/app/hooks/useAI.ts b/apps/nextjs-app/src/features/app/hooks/useAI.ts index 3ff591ade..2a91511cb 100644 --- a/apps/nextjs-app/src/features/app/hooks/useAI.ts +++ b/apps/nextjs-app/src/features/app/hooks/useAI.ts @@ -1,13 +1,14 @@ import { useQuery } from '@tanstack/react-query'; import { getAIConfig } from '@teable/openapi'; -import { useBaseId } from '@teable/sdk/hooks'; +import { useBaseId, useIsReadOnlyPreview } from '@teable/sdk/hooks'; export function useAI() { const baseId = useBaseId() as string; + const isReadOnlyPreview = useIsReadOnlyPreview(); const { data } = useQuery({ queryKey: ['ai-config', baseId], queryFn: () => getAIConfig(baseId).then(({ data }) => data), - enabled: Boolean(baseId), + enabled: Boolean(baseId) && !isReadOnlyPreview, }); return {