not having it if it's too high of a index
This commit is contained in:
@@ -114,13 +114,19 @@ export function ConversationRow({
|
|||||||
const rendersCount = useRendersCount();
|
const rendersCount = useRendersCount();
|
||||||
console.warn('RENDER COUNT | CONVERSATION LIST ROW | ', rendersCount);
|
console.warn('RENDER COUNT | CONVERSATION LIST ROW | ', rendersCount);
|
||||||
|
|
||||||
const keyboardShortcut = useMemo(() => index + 1, [index]);
|
const keyboardShortcut = useMemo(() => {
|
||||||
|
if (index < 9) {
|
||||||
|
return index + 1;
|
||||||
|
}
|
||||||
|
|
||||||
const handleSelectConversation = useCallback(
|
return undefined;
|
||||||
() => selectConversation(conversation.id),
|
}, [index]);
|
||||||
[conversation.id, selectConversation],
|
|
||||||
);
|
const handleSelectConversation = useCallback(() => {
|
||||||
useKeyPressEvent(`${keyboardShortcut.toString()}`, handleSelectConversation);
|
selectConversation(conversation.id);
|
||||||
|
}, [conversation.id, selectConversation]);
|
||||||
|
|
||||||
|
useKeyPressEvent(`${keyboardShortcut?.toString()}`, handleSelectConversation);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem key={`${conversation.id}-priorityConvoList`}>
|
<ListItem key={`${conversation.id}-priorityConvoList`}>
|
||||||
@@ -139,7 +145,7 @@ export function ConversationRow({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<Stack direction={'row'} spacing={1} sx={{ ml: 2, mr: 'auto', color: 'GrayText' }}>
|
<Stack direction={'row'} spacing={1} sx={{ ml: 2, mr: 'auto', color: 'GrayText' }}>
|
||||||
<KeyboardShortcutLabel label={keyboardShortcut.toString()} />
|
{keyboardShortcut && <KeyboardShortcutLabel label={keyboardShortcut.toString()} />}
|
||||||
<ConversationLabel
|
<ConversationLabel
|
||||||
users={conversation.userCache ?? []}
|
users={conversation.userCache ?? []}
|
||||||
conversationName={conversation.name}
|
conversationName={conversation.name}
|
||||||
|
|||||||
Reference in New Issue
Block a user