From 0b672fd9f2e1daf05fe7a0f4d0861b938834b4cf Mon Sep 17 00:00:00 2001 From: xuzijie1995 <18852951350@163.com> Date: Tue, 27 May 2025 14:24:40 +0800 Subject: [PATCH] fix: Correct markdown component imports and hook usage Addresses ErrorBoundary import in and call in . --- web/app/components/base/markdown-blocks/code-block.tsx | 2 +- web/app/components/base/markdown-blocks/link.tsx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/web/app/components/base/markdown-blocks/code-block.tsx b/web/app/components/base/markdown-blocks/code-block.tsx index cede9b469f..9f8a6a87bb 100644 --- a/web/app/components/base/markdown-blocks/code-block.tsx +++ b/web/app/components/base/markdown-blocks/code-block.tsx @@ -13,7 +13,7 @@ import { Theme } from '@/types/app' import useTheme from '@/hooks/use-theme' import SVGRenderer from '../svg-gallery' // Assumes svg-gallery.tsx is in /base directory import MarkdownMusic from '@/app/components/base/markdown-blocks/music' -import ErrorBoundary from '@/app/components/base/markdown' +import ErrorBoundary from '@/app/components/base/markdown/error-boundary' // Available language https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_HLJS.MD const capitalizationLanguageNameMap: Record = { diff --git a/web/app/components/base/markdown-blocks/link.tsx b/web/app/components/base/markdown-blocks/link.tsx index 5104d1ea04..b243a525a0 100644 --- a/web/app/components/base/markdown-blocks/link.tsx +++ b/web/app/components/base/markdown-blocks/link.tsx @@ -7,9 +7,8 @@ import React from 'react' import { useChatContext } from '@/app/components/base/chat/chat/context' const Link = ({ node, children, ...props }: any) => { + const { onSend } = useChatContext() if (node.properties?.href && node.properties.href?.toString().startsWith('abbr')) { - // eslint-disable-next-line react-hooks/rules-of-hooks - const { onSend } = useChatContext() const hidden_text = decodeURIComponent(node.properties.href.toString().split('abbr:')[1]) return onSend?.(hidden_text)} title={node.children[0]?.value || ''}>{node.children[0]?.value || ''}