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 f263c8f commit df62efb
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 df62efb

Please sign in to comment.