Skip to content

Commit

Permalink
refactor: rename vars
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
WofWca committed Oct 4, 2024
1 parent ece68d7 commit 73d03d1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/frontend/src/components/chat/ChatListHelpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined>(_queryStr)
const [queryContactId, setQueryContactId] = useState(_queryContactId)
const [listFlags, setListFlags] = useState(initialListFlags)
const [queryStr, setQueryStr] = useState<string | undefined>(initialQueryStr)
const [queryContactId, setQueryContactId] = useState(initialQueryContactId)
const [chatListEntries, setChatListEntries] = useState<number[]>([])

const debouncedGetChatListEntries = useMemo(
Expand Down

0 comments on commit 73d03d1

Please sign in to comment.