From 878ec1e78224cba26b4875b30c1915a09cf1c2c9 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Thu, 14 Nov 2024 05:00:32 -0800 Subject: [PATCH] fixing bugs --- .../react/src/sidebar-tsx/SidebarChat.tsx | 7 ++-- .../src/sidebar-tsx/SidebarThreadSelector.tsx | 2 +- .../void/browser/registerInlineDiffs.ts | 41 +++++++++++-------- .../contrib/void/browser/registerThreads.ts | 7 ++-- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index 868e164e..eefa19ba 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -1,7 +1,7 @@ import React, { FormEvent, useCallback, useRef, useState } from 'react'; -import { useConfigState, useService, useSidebarState, useThreadsState } from '../util/services.js'; +import { useConfigState, useService, useThreadsState } from '../util/services.js'; import { URI } from '../../../../../../../base/common/uri.js'; import { VSReadFile } from '../../../registerInlineDiffs.js'; import { sendLLMMessage } from '../util/sendLLMMessage.js'; @@ -128,6 +128,7 @@ export const SidebarChat = () => { const { voidConfig } = configState // threads state + const threadsState = useThreadsState() const threadsStateService = useService('threadsStateService') // ----- SIDEBAR CHAT state (local) ----- @@ -180,7 +181,7 @@ export const SidebarChat = () => { const newHistoryElt: ChatMessage = { role: 'user', content: userContent, displayContent: instructions, selection, files } threadsStateService.addMessageToCurrentThread(newHistoryElt) - const currentThread = threadsStateService.getCurrentThread() + const currentThread = threadsStateService.getCurrentThread(threadsStateService.state) // the the instant state right now, don't wait for the React state // send message to LLM @@ -229,7 +230,7 @@ export const SidebarChat = () => { }, [messageStream, threadsStateService]) - const currentThread = threadsStateService.getCurrentThread() + const currentThread = threadsStateService.getCurrentThread(threadsState) return <>
{/* previous messages */} diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarThreadSelector.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarThreadSelector.tsx index f3269b43..1ac6ddd2 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarThreadSelector.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarThreadSelector.tsx @@ -66,7 +66,7 @@ export const SidebarThreadSelector = () => { return (