diff --git a/web/src/components/ui/layouts/AppSplitter/AppSplitter.tsx b/web/src/components/ui/layouts/AppSplitter/AppSplitter.tsx
index 53927c83b..a7d7ec1fc 100644
--- a/web/src/components/ui/layouts/AppSplitter/AppSplitter.tsx
+++ b/web/src/components/ui/layouts/AppSplitter/AppSplitter.tsx
@@ -1,6 +1,6 @@
'use client';
-import { useMemoizedFn } from '@/hooks';
+import { useMemoizedFn, useMount } from '@/hooks';
import React, {
useEffect,
useMemo,
@@ -251,6 +251,11 @@ export const AppSplitter = React.memo(
// Add useImperativeHandle to expose the function
useImperativeHandle(ref, imperativeHandleMethods);
+ const isNested = useMemo(() => {
+ console.log('ref', ref);
+ return !!ref;
+ }, [ref]);
+
return (
= ({ children }) => {
const appSplitterRef = useRef(null);
+ const [mounted, setMounted] = useState(false);
+
const chatLayoutProps = useChatLayoutContext({ appSplitterRef });
const { selectedLayout, selectedFile } = chatLayoutProps;
@@ -23,22 +26,19 @@ export const ChatLayout: React.FC = ({ children }) => {
return ['380px', 'auto'];
}, [selectedLayout]);
+ useMount(() => {
+ setMounted(true); //we need to wait for the app splitter to be mounted because this is nested in the app splitter
+ });
+
return (
(
-
- ),
- []
- )}
+ leftChildren={useMemo(() => mounted && , [mounted])}
rightChildren={useMemo(
- () => (
- {children}
- ),
- [children]
+ () => mounted && {children},
+ [children, mounted]
)}
autoSaveId="chat-splitter"
defaultLayout={defaultSplitterLayout}