Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ research_ideas.md
skills-lock.json
lint_final.json
.next-analyze/
docs/github-issues.md
8 changes: 0 additions & 8 deletions modules/playground/components/ai-chat-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string,unknown>).type === "string" && ((p as Record<string,unknown>).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<string, unknown>;
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 10 additions & 3 deletions modules/playground/components/playground-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ const PlaygroundEditor = ({
const monacoRef = useRef<Monaco | null>(null);
const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | 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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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(() => {
Expand Down
Loading