mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-21 08:04:20 +01:00
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:
@@ -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]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user