11import { useState , useCallback } from "react" ;
22import { useDispatch , useSelector } from "react-redux" ;
33import { useDeepCompareEffect , useUpdateEffect } from "react-use" ;
4- import { trace } from "firebase/performance" ;
54import {
65 DiscussionMessageService ,
76 MESSAGES_NUMBER_IN_BATCH ,
@@ -21,7 +20,7 @@ import {
2120 User ,
2221} from "@/shared/models" ;
2322import { InternalLinkData } from "@/shared/utils" ;
24- import firebase , { perf } from "@/shared/utils/firebase" ;
23+ import firebase from "@/shared/utils/firebase" ;
2524import {
2625 cacheActions ,
2726 selectDiscussionMessagesStateByDiscussionId ,
@@ -154,10 +153,7 @@ export const useDiscussionMessagesById = ({
154153
155154 const fetchRepliedMessages = useCallback (
156155 async ( messageId : string , endDate : Date ) : Promise < void > => {
157- const fetchRepliedMessagesTrace = trace ( perf , 'fetchRepliedMessagesTrace' ) ;
158156 try {
159- fetchRepliedMessagesTrace . start ( ) ;
160-
161157 if ( state . data ?. find ( ( item ) => item . id === messageId ) ) {
162158 return Promise . resolve ( ) ;
163159 }
@@ -211,9 +207,8 @@ export const useDiscussionMessagesById = ({
211207 updatedDiscussionMessages : discussionsWithText ,
212208 } ) ,
213209 ) ;
214- fetchRepliedMessagesTrace . stop ( ) ;
215210 } catch ( err ) {
216- fetchRepliedMessagesTrace . stop ( ) ;
211+ // console.log(err );
217212 }
218213 } ,
219214 [
@@ -248,9 +243,6 @@ export const useDiscussionMessagesById = ({
248243 }
249244
250245 try {
251- const fetchDiscussionMessagesTrace = trace ( perf , 'fetchDiscussionMessages' ) ;
252- fetchDiscussionMessagesTrace . start ( ) ;
253-
254246 DiscussionMessageService . subscribeToDiscussionMessagesByDiscussionId (
255247 discussionId ,
256248 lastVisible && lastVisible [ discussionId ] ,
@@ -320,7 +312,6 @@ export const useDiscussionMessagesById = ({
320312 setIsBatchLoading ( false ) ;
321313 } ,
322314 ) ;
323- fetchDiscussionMessagesTrace . stop ( ) ;
324315 } catch ( err ) {
325316 setIsBatchLoading ( false ) ;
326317 }
0 commit comments