File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export const Dashboard = () => {
38
38
hasMoreConversation : false ,
39
39
} ) ;
40
40
const cancelToken = useRef ( axios . CancelToken . source ( ) ) ;
41
+ const initFlag = useRef ( true ) ;
41
42
42
43
useEffect ( ( ) => {
43
44
if ( ! timeRange . from || ! timeRange . to ) return ;
@@ -52,18 +53,20 @@ export const Dashboard = () => {
52
53
setConversationList ( conversation_list ) ;
53
54
setPageState ( ( prev ) => ( {
54
55
...prev ,
56
+ conversationPage : 2 ,
55
57
hasMoreConversation :
56
58
conversation_list . length === ConversationPageSize ,
57
59
conversationInitLoading : false ,
58
- messageInitLoading : ! isEmpty ,
60
+ messageInitLoading : initFlag . current && ! isEmpty ,
59
61
} ) ) ;
60
- if ( ! isEmpty ) {
62
+ if ( ! isEmpty && initFlag . current ) {
61
63
selectConversation ( conversation_list [ 0 ] . user_id ) ;
62
64
}
63
65
} )
64
66
. catch ( ( ) =>
65
67
setPageState ( ( prev ) => ( { ...prev , conversationInitLoading : false } ) )
66
- ) ;
68
+ )
69
+ . finally ( ( ) => ( initFlag . current = false ) ) ;
67
70
} , [ timeRange ] ) ;
68
71
69
72
const onOpenChange = useCallback ( ( open : boolean , message ?: API . ChatLog ) => {
You can’t perform that action at this time.
0 commit comments