Cleanup Phase 1: Remove unused React imports from safe components (#2702)

Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
Zane
2025-05-29 09:13:26 -07:00
committed by GitHub
parent bf1c0d51e4
commit 3d5d3cedca
108 changed files with 203 additions and 194 deletions

View File

@@ -1,4 +1,4 @@
import React, { useRef, useState, useEffect, useCallback } from 'react';
import React, { useRef, useState, useEffect, useMemo } from 'react';
import { Button } from './ui/button';
import type { View } from '../App';
import Stop from './ui/Stop';
@@ -148,21 +148,20 @@ export default function ChatInput({
}, [droppedFiles, processedFilePaths, displayValue]);
// Debounced function to update actual value
const debouncedSetValue = useCallback((val: string) => {
debounce((value: string) => {
const debouncedSetValue = useMemo(
() => debounce((value: string) => {
setValue(value);
}, 150)(val);
}, []);
}, 150),
[setValue]
);
// Debounced autosize function
const debouncedAutosize = useCallback(
(textArea: HTMLTextAreaElement) => {
debounce((element: HTMLTextAreaElement) => {
element.style.height = '0px'; // Reset height
const scrollHeight = element.scrollHeight;
element.style.height = Math.min(scrollHeight, maxHeight) + 'px';
}, 150)(textArea);
},
const debouncedAutosize = useMemo(
() => debounce((element: HTMLTextAreaElement) => {
element.style.height = '0px'; // Reset height
const scrollHeight = element.scrollHeight;
element.style.height = Math.min(scrollHeight, maxHeight) + 'px';
}, 150),
[maxHeight]
);