Skip to content

Commit

Permalink
Merge pull request #2731 from daostack/CW-hotfix-app-crash
Browse files Browse the repository at this point in the history
[HOTFIX] App crash
  • Loading branch information
MeyerPV authored Sep 3, 2024
2 parents 417883f + f5d9c71 commit f572fee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
6 changes: 0 additions & 6 deletions src/pages/OldCommon/hooks/useCommonMembers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useCallback, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { trace } from "firebase/performance";
import { CommonService, Logger, UserService } from "@/services";
import { store } from "@/shared/appConfig";
import { LoadingState } from "@/shared/interfaces";
Expand All @@ -11,7 +10,6 @@ import {
selectUserStates,
} from "@/store/states";
import { useDeepCompareEffect } from "react-use";
import { perf } from "@/shared/utils/firebase";

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

(async () => {
try {
const useCommonMembersTrace = trace(perf, 'useCommonMembers');
useCommonMembersTrace.start();

const cachedUserStates = selectUserStates()(store.getState());
const hasUsersFromCache = commonMembers.some(
({ userId }) => cachedUserStates[userId]?.data,
Expand Down Expand Up @@ -188,7 +183,6 @@ export const useCommonMembers = ({ commonId }: Options): Return => {
};
});
dispatch(cacheActions.updateUserStates(fetchedUsers));
useCommonMembersTrace.stop();
} catch (err) {
Logger.error(err);
setState((prevState) => ({
Expand Down
13 changes: 2 additions & 11 deletions src/shared/hooks/useCases/useDiscussionMessagesById.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState, useCallback } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useDeepCompareEffect, useUpdateEffect } from "react-use";
import { trace } from "firebase/performance";
import {
DiscussionMessageService,
MESSAGES_NUMBER_IN_BATCH,
Expand All @@ -21,7 +20,7 @@ import {
User,
} from "@/shared/models";
import { InternalLinkData } from "@/shared/utils";
import firebase, { perf } from "@/shared/utils/firebase";
import firebase from "@/shared/utils/firebase";
import {
cacheActions,
selectDiscussionMessagesStateByDiscussionId,
Expand Down Expand Up @@ -154,10 +153,7 @@ export const useDiscussionMessagesById = ({

const fetchRepliedMessages = useCallback(
async (messageId: string, endDate: Date): Promise<void> => {
const fetchRepliedMessagesTrace = trace(perf, 'fetchRepliedMessagesTrace');
try {
fetchRepliedMessagesTrace.start();

if (state.data?.find((item) => item.id === messageId)) {
return Promise.resolve();
}
Expand Down Expand Up @@ -211,9 +207,8 @@ export const useDiscussionMessagesById = ({
updatedDiscussionMessages: discussionsWithText,
}),
);
fetchRepliedMessagesTrace.stop();
} catch(err) {
fetchRepliedMessagesTrace.stop();
// console.log(err);
}
},
[
Expand Down Expand Up @@ -248,9 +243,6 @@ export const useDiscussionMessagesById = ({
}

try {
const fetchDiscussionMessagesTrace = trace(perf, 'fetchDiscussionMessages');
fetchDiscussionMessagesTrace.start();

DiscussionMessageService.subscribeToDiscussionMessagesByDiscussionId(
discussionId,
lastVisible && lastVisible[discussionId],
Expand Down Expand Up @@ -320,7 +312,6 @@ export const useDiscussionMessagesById = ({
setIsBatchLoading(false);
},
);
fetchDiscussionMessagesTrace.stop();
} catch(err) {
setIsBatchLoading(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const FeedItemBreadcrumbs: FC<FeedItemBreadcrumbsProps> = ({
});

return () => {
unsubscribe();
unsubscribe && unsubscribe();
};
}, [breadcrumbs.activeItem?.id]);

Expand Down

0 comments on commit f572fee

Please sign in to comment.