From b9137c2a10e819e0954f6b8ec158633cb3d718e3 Mon Sep 17 00:00:00 2001 From: YasinOnm08 Date: Wed, 9 Oct 2024 14:22:31 +0200 Subject: [PATCH] build fix for sure for sure --- app/backend/InputOutputHandler.tsx | 2 +- app/components/History.tsx | 7 +------ app/hooks/useChatHistory.tsx | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/backend/InputOutputHandler.tsx b/app/backend/InputOutputHandler.tsx index d40f9fb..1a4817b 100644 --- a/app/backend/InputOutputHandler.tsx +++ b/app/backend/InputOutputHandler.tsx @@ -14,7 +14,7 @@ const InputOutputBackend: React.FC = () => { } // Define state variables for user preferences and messages - const [chatHistory, setChatHistory, setSelectedIndex, updateMessage] = useChatHistory() + const [chatHistory, setSelectedIndex, setChatHistory, updateMessage] = useChatHistory() const [preferredCurrency, setPreferredCurrency] = useState("USD"); const [preferredLanguage, setPreferredLanguage] = useState("english"); const [timeFormat, setTimeFormat] = useState("24-hour"); diff --git a/app/components/History.tsx b/app/components/History.tsx index b3cf197..0aae50f 100644 --- a/app/components/History.tsx +++ b/app/components/History.tsx @@ -2,18 +2,13 @@ import React, { useState } from 'react'; import { useChatHistory } from '../hooks/useChatHistory'; const History: React.FC = () => { - const [chatHistory, setChatHistory, setSelectedIndex] = useChatHistory() + const [chatHistory, setSelectedIndex] = useChatHistory() const [isEditing, setIsEditing] = useState(false); const [inputValue, setInputValue] = useState(''); - setChatHistory(chatHistory) const handleEditButtonClick = () => { setIsEditing(true); - - /* Thank you Eslint for this masterpiece of a code snippet */ - setChatHistory(chatHistory) - /* Wow i feel so secure now */ }; const handleInputChange = (e: React.ChangeEvent) => { diff --git a/app/hooks/useChatHistory.tsx b/app/hooks/useChatHistory.tsx index b153eef..29f9b97 100644 --- a/app/hooks/useChatHistory.tsx +++ b/app/hooks/useChatHistory.tsx @@ -31,7 +31,7 @@ const setGlobalState = (newState: GlobalChatHistory): void => { listeners.forEach((listener) => listener(globalChatHistory)) } -export const useChatHistory = (): [GlobalChatHistory, (newState:GlobalChatHistory) => void, (index:number)=>void, (messageIndex: number, newContent:string)=> void] => { +export const useChatHistory = (): [GlobalChatHistory, (index:number)=>void, (newState:GlobalChatHistory) => void,(messageIndex: number, newContent:string)=> void] => { const [state, setState] = useState(globalChatHistory) useEffect(() => { @@ -65,5 +65,5 @@ export const useChatHistory = (): [GlobalChatHistory, (newState:GlobalChatHistor } } - return [state, setGlobalState, setSelectedIndex, updateMessage] + return [state, setSelectedIndex, setGlobalState, updateMessage] } \ No newline at end of file