From 73d03d1b5562ac4ef48c6fcaf73c2be4fec1f7e9 Mon Sep 17 00:00:00 2001 From: WofWca Date: Fri, 4 Oct 2024 17:15:53 +0400 Subject: [PATCH] refactor: rename vars Since these parameters are only used as `initialState` arguments for `useState`, it makes sense to name them as such. The API of `useChatList` is similar to that of `useState`. --- .../src/components/chat/ChatListHelpers.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/frontend/src/components/chat/ChatListHelpers.tsx b/packages/frontend/src/components/chat/ChatListHelpers.tsx index 5f5fc3335..3619f8688 100644 --- a/packages/frontend/src/components/chat/ChatListHelpers.tsx +++ b/packages/frontend/src/components/chat/ChatListHelpers.tsx @@ -54,19 +54,19 @@ export function useMessageResults( } export function useChatList( - _listFlags: number | null = null, - _queryStr?: string, - _queryContactId?: number + initialListFlags: number | null = null, + initialQueryStr?: string, + initialQueryContactId?: number ) { if (window.__selectedAccountId === undefined) { throw new Error('no context selected') } const accountId = window.__selectedAccountId - if (!_queryStr) _queryStr = '' + if (!initialQueryStr) initialQueryStr = '' - const [listFlags, setListFlags] = useState(_listFlags) - const [queryStr, setQueryStr] = useState(_queryStr) - const [queryContactId, setQueryContactId] = useState(_queryContactId) + const [listFlags, setListFlags] = useState(initialListFlags) + const [queryStr, setQueryStr] = useState(initialQueryStr) + const [queryContactId, setQueryContactId] = useState(initialQueryContactId) const [chatListEntries, setChatListEntries] = useState([]) const debouncedGetChatListEntries = useMemo(