File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
shared/chat/conversation/list-area Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,21 @@ export const useActions = (p: {conversationIDKey: T.Chat.ConversationIDKey}) =>
19
19
}
20
20
21
21
export const useJumpToRecent = ( scrollToBottom : ( ) => void , numOrdinals : number ) => {
22
- const containsLatestMessage = C . useChatContext ( s => {
23
- return s . isCaughtUp ( )
24
- } )
25
- const toggleThreadSearch = C . useChatContext ( s => s . dispatch . toggleThreadSearch )
26
- const jumpToRecent = C . useChatContext ( s => s . dispatch . jumpToRecent )
22
+ const data = C . useChatContext (
23
+ C . useShallow ( s => {
24
+ const containsLatestMessage = s . isCaughtUp ( )
25
+ const { loaded} = s
26
+ const { jumpToRecent, toggleThreadSearch} = s . dispatch
27
+ return { containsLatestMessage, jumpToRecent, loaded, toggleThreadSearch}
28
+ } )
29
+ )
30
+ const { containsLatestMessage, jumpToRecent, loaded, toggleThreadSearch} = data
27
31
28
32
const onJump = React . useCallback ( ( ) => {
29
33
scrollToBottom ( )
30
34
jumpToRecent ( )
31
35
toggleThreadSearch ( true )
32
36
} , [ toggleThreadSearch , jumpToRecent , scrollToBottom ] )
33
37
34
- return ! containsLatestMessage && numOrdinals > 0 && < JumpToRecent onClick = { onJump } />
38
+ return loaded && ! containsLatestMessage && numOrdinals > 0 && < JumpToRecent onClick = { onJump } />
35
39
}
You can’t perform that action at this time.
0 commit comments