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 3c3e00d3..39896d96 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 @@ -27,7 +27,7 @@ export const SidebarThreadSelector = () => { const sortedThreadIds = Object.keys(allThreads ?? {}).sort((threadId1, threadId2) => allThreads![threadId1].lastModified > allThreads![threadId2].lastModified ? -1 : 1) return ( -
+
{/* X button at top right */}
@@ -49,7 +49,7 @@ export const SidebarThreadSelector = () => {
{/* a list of all the past threads */} -
+
{sortedThreadIds.map((threadId) => { if (!allThreads) return <>Error: Threads not found. diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx index 2edc0137..c1df63bb 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useRef, useState } from 'react' +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js' import { ProviderName, SettingName, displayInfoOfSettingName, titleOfProviderName, providerNames, ModelInfo } from '../../../../../../../platform/void/common/voidSettingsTypes.js' import ErrorBoundary from '../sidebar-tsx/ErrorBoundary.js' @@ -36,7 +36,7 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => { const [errorString, setErrorString] = useState('') - const providerOptions = providerNames.map(providerName => ({ text: titleOfProviderName(providerName), value: providerName })) + const providerOptions = useMemo(() => providerNames.map(providerName => ({ text: titleOfProviderName(providerName), value: providerName })), [providerNames]) return <>
@@ -44,7 +44,7 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => {
{ modelNameRef.current = modelName }} + onChangeText={useCallback((modelName) => { modelNameRef.current = modelName }, [])} multiline={false} />
@@ -52,8 +52,8 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => { {/* provider */}
{ providerNameRef.current = providerOptions[0].value }} // initialize state - onChangeSelection={(providerName: ProviderName) => { console.log('selecting provider', providerName); providerNameRef.current = providerName }} + onCreateInstance={useCallback(() => { providerNameRef.current = providerOptions[0].value }, [providerOptions])} // initialize state + onChangeSelection={useCallback((providerName: ProviderName) => { providerNameRef.current = providerName }, [])} options={providerOptions} />