Skip to content

Commit

Permalink
fix: focus conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurlbrjc committed Oct 23, 2024
1 parent 9a68638 commit 71866d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/chat/Conversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ export function Conversation({
}, [beneficiaireChat.chatId, observerMessages])

useEffect(() => {
if (!messagesByDay?.length) {
if (!nombrePagesChargees) return

if (!messagesByDay!.length) {
headerChatRef.current!.focusRetour()
return
}
Expand All @@ -337,7 +339,7 @@ export function Conversation({
if (nombrePagesChargees! > 1 && idPrecedentPremierMessage.current) {
const idMessageToFocus = getPreviousItemId(
idPrecedentPremierMessage.current,
messagesByDay
messagesByDay!
)
const toFocus = idMessageToFocus
? document.getElementById(`message-${idMessageToFocus}`)!
Expand Down

0 comments on commit 71866d1

Please sign in to comment.