diff --git a/.gitignore b/.gitignore index 6cec7573..c4e60742 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ research_ideas.md skills-lock.json lint_final.json .next-analyze/ +docs/github-issues.md \ No newline at end of file diff --git a/modules/playground/components/ai-chat-panel.tsx b/modules/playground/components/ai-chat-panel.tsx index dfc86196..cb38b05c 100644 --- a/modules/playground/components/ai-chat-panel.tsx +++ b/modules/playground/components/ai-chat-panel.tsx @@ -169,13 +169,6 @@ export default function AIChatPanel({ const rawParts: unknown[] = (lastMessage as unknown as { parts?: unknown[] }).parts ?? []; - // Debug: log all parts to see what v3 sends - if (rawParts.length > 0) { - const toolParts = rawParts.filter((p) => typeof (p as Record).type === "string" && ((p as Record).type as string).startsWith("tool-")); - if (toolParts.length > 0) { - console.log("[AIChatPanel] Tool parts in last message:", JSON.stringify(toolParts, null, 2)); - } - } for (const rawPart of rawParts) { const part = rawPart as Record; @@ -299,7 +292,6 @@ export default function AIChatPanel({ // Mark as processed BEFORE calling addToolResult to prevent re-execution on re-render processedToolCallIds.current.add(toolCallId); - console.log(`[AIChatPanel] Executed tool ${toolName} (${toolCallId}), result:`, result.slice(0, 100)); addToolResult({ toolCallId, diff --git a/modules/playground/components/playground-editor.tsx b/modules/playground/components/playground-editor.tsx index 1434060a..521b0055 100644 --- a/modules/playground/components/playground-editor.tsx +++ b/modules/playground/components/playground-editor.tsx @@ -47,9 +47,15 @@ const PlaygroundEditor = ({ const monacoRef = useRef(null); const debounceTimerRef = useRef | null>(null); const bindingRef = useRef<{ destroy: () => void } | null>(null); + const contentRef = useRef(content); const { data: session } = useSession(); const [isMounted, setIsMounted] = useState(false); + // Keep contentRef in sync without triggering the Yjs binding effect + useEffect(() => { + contentRef.current = content; + }, [content]); + const handleEditorDidMount = (editor: MonacoEditor.IStandaloneCodeEditor, monaco: Monaco) => { editorRef.current = editor; monacoRef.current = monaco; @@ -305,8 +311,8 @@ const PlaygroundEditor = ({ const yText = doc.getText(fileKey); // Initial content population if empty - if (yText.length === 0 && content) { - yText.insert(0, content); + if (yText.length === 0 && contentRef.current) { + yText.insert(0, contentRef.current); } if (bindingRef.current) { @@ -410,7 +416,8 @@ const PlaygroundEditor = ({ bindingRef.current = null; } }; - }, [activeFile, playgroundId, isMounted, content, session]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [activeFile, playgroundId, isMounted, session]); // Cleanup on unmount useEffect(() => {