Skip to content

Commit f572fee

Browse files
authored
Merge pull request #2731 from daostack/CW-hotfix-app-crash
[HOTFIX] App crash
2 parents 417883f + f5d9c71 commit f572fee

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

src/pages/OldCommon/hooks/useCommonMembers.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useCallback, useRef, useState } from "react";
22
import { useDispatch, useSelector } from "react-redux";
3-
import { trace } from "firebase/performance";
43
import { CommonService, Logger, UserService } from "@/services";
54
import { store } from "@/shared/appConfig";
65
import { LoadingState } from "@/shared/interfaces";
@@ -11,7 +10,6 @@ import {
1110
selectUserStates,
1211
} from "@/store/states";
1312
import { useDeepCompareEffect } from "react-use";
14-
import { perf } from "@/shared/utils/firebase";
1513

1614
interface Options {
1715
commonId?: string;
@@ -113,9 +111,6 @@ export const useCommonMembers = ({ commonId }: Options): Return => {
113111

114112
(async () => {
115113
try {
116-
const useCommonMembersTrace = trace(perf, 'useCommonMembers');
117-
useCommonMembersTrace.start();
118-
119114
const cachedUserStates = selectUserStates()(store.getState());
120115
const hasUsersFromCache = commonMembers.some(
121116
({ userId }) => cachedUserStates[userId]?.data,
@@ -188,7 +183,6 @@ export const useCommonMembers = ({ commonId }: Options): Return => {
188183
};
189184
});
190185
dispatch(cacheActions.updateUserStates(fetchedUsers));
191-
useCommonMembersTrace.stop();
192186
} catch (err) {
193187
Logger.error(err);
194188
setState((prevState) => ({

src/shared/hooks/useCases/useDiscussionMessagesById.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useState, useCallback } from "react";
22
import { useDispatch, useSelector } from "react-redux";
33
import { useDeepCompareEffect, useUpdateEffect } from "react-use";
4-
import { trace } from "firebase/performance";
54
import {
65
DiscussionMessageService,
76
MESSAGES_NUMBER_IN_BATCH,
@@ -21,7 +20,7 @@ import {
2120
User,
2221
} from "@/shared/models";
2322
import { InternalLinkData } from "@/shared/utils";
24-
import firebase, { perf } from "@/shared/utils/firebase";
23+
import firebase from "@/shared/utils/firebase";
2524
import {
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
}

src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/FeedItemBreadcrumbs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const FeedItemBreadcrumbs: FC<FeedItemBreadcrumbsProps> = ({
6767
});
6868

6969
return () => {
70-
unsubscribe();
70+
unsubscribe && unsubscribe();
7171
};
7272
}, [breadcrumbs.activeItem?.id]);
7373

0 commit comments

Comments
 (0)