From f01bcf60eeee6b6034ca064282f5710cc98390f2 Mon Sep 17 00:00:00 2001
From: nitin <142569587+ehconitin@users.noreply.github.com>
Date: Fri, 3 Apr 2026 14:59:45 +0530
Subject: [PATCH] [AI] Fix record chips not rendering inside markdown tables in
AI chat (#19260)
closes
https://discord.com/channels/1130383047699738754/1480976327204016131
before -
after -
---
.../ai/components/LazyMarkdownRenderer.tsx | 24 ++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx b/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx
index 40c005d1142..51cc1fb56b8 100644
--- a/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx
+++ b/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx
@@ -10,7 +10,13 @@ import {
StyledSkeletonContainer,
StyledTableScrollContainer,
} from '@/ai/components/LazyMarkdownRendererStyledComponents';
-import { lazy, Suspense, useContext } from 'react';
+import {
+ cloneElement,
+ isValidElement,
+ lazy,
+ Suspense,
+ useContext,
+} from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { isDefined } from 'twenty-shared/utils';
import { ThemeContext } from 'twenty-ui/theme-constants';
@@ -64,6 +70,16 @@ const processChildrenForRecordLinks = (
));
}
+ if (isValidElement<{ children?: React.ReactNode }>(children)) {
+ const childProps = children.props;
+
+ if (isDefined(childProps.children)) {
+ return cloneElement(children, {
+ children: processChildrenForRecordLinks(childProps.children),
+ });
+ }
+ }
+
return children;
};
@@ -96,6 +112,12 @@ const MarkdownRenderer = lazy(async () => {
{processChildrenForRecordLinks(children)}
),
+ td: ({ children }) => (
+