TP-65182 | App slowness fix
This commit is contained in:
@@ -80,19 +80,13 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
const isOnline = useIsOnline();
|
||||
const dispatch = useAppDispatch();
|
||||
const appState = useRef(AppState.currentState);
|
||||
const {
|
||||
isTeamLead,
|
||||
caseSyncLock,
|
||||
referenceId,
|
||||
pendingList = [],
|
||||
pinnedList = [],
|
||||
} = useAppSelector((state) => ({
|
||||
isTeamLead: state.user.isTeamLead,
|
||||
caseSyncLock: state?.user?.caseSyncLock,
|
||||
referenceId: state.user.user?.referenceId!,
|
||||
pendingList: state.allCases.pendingList,
|
||||
pinnedList: state.allCases.pinnedList,
|
||||
}));
|
||||
|
||||
const isTeamLead = useAppSelector((state) => state.user.isTeamLead);
|
||||
const caseSyncLock = useAppSelector((state) => state?.user?.caseSyncLock);
|
||||
const referenceId = useAppSelector((state) => state.user.user?.referenceId!);
|
||||
const pendingList = useAppSelector((state) => state.allCases.pendingList);
|
||||
const pinnedList = useAppSelector((state) => state.allCases.pinnedList);
|
||||
|
||||
|
||||
const handleTimeSync = async () => {
|
||||
try {
|
||||
|
||||
@@ -35,14 +35,19 @@ export const loggedOutCurrentUser = async () => {
|
||||
const isUserSignedIn = () => !!auth().currentUser;
|
||||
|
||||
const useFirestoreUpdates = () => {
|
||||
const {
|
||||
user: { user, isLoggedIn, sessionDetails, lock, selectedAgent = MY_CASE_ITEM, isExternalAgent },
|
||||
allCases: { caseDetails, casesList },
|
||||
} = useAppSelector((state: RootState) => ({
|
||||
user: state.user || {},
|
||||
allCases: state.allCases,
|
||||
}));
|
||||
const isTeamLead = useAppSelector((state) => state.user.isTeamLead);
|
||||
const caseDetails = useAppSelector((state) => state.allCases.caseDetails);
|
||||
const casesList = useAppSelector((state) => state.allCases.casesList);
|
||||
|
||||
const userData = useAppSelector((state) => state.user);
|
||||
const {
|
||||
user,
|
||||
isLoggedIn,
|
||||
sessionDetails,
|
||||
lock,
|
||||
selectedAgent = MY_CASE_ITEM,
|
||||
isExternalAgent,
|
||||
} = userData || {};
|
||||
const lockRef = useRef<ILockData | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -260,7 +265,7 @@ const useFirestoreUpdates = () => {
|
||||
};
|
||||
|
||||
const subscribeToCsaFilters = () => {
|
||||
const collectionPath = "global-filters/v1";
|
||||
const collectionPath = 'global-filters/v1';
|
||||
return subscribeToDoc(handleCsaFilters, collectionPath);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,10 +7,8 @@ import ScreenshotBlocker from '../components/utlis/ScreenshotBlocker';
|
||||
import { addClickstreamEvent } from '../services/clickstreamEventService';
|
||||
|
||||
const useScreenshotTracking = () => {
|
||||
const { user, allCases } = useAppSelector((state) => ({
|
||||
user: state.user,
|
||||
allCases: state.allCases,
|
||||
}));
|
||||
const user = useAppSelector((state) => state.user);
|
||||
const selectedCaseId = useAppSelector((state) => state.allCases.selectedCaseId);
|
||||
|
||||
const screenshotEventEmitter = useMemo(() => new NativeEventEmitter(ScreenshotBlocker), []);
|
||||
|
||||
@@ -25,7 +23,7 @@ const useScreenshotTracking = () => {
|
||||
if (event?.isScreenshotDetected) {
|
||||
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_SCREENSHOT_TAKEN, {
|
||||
userId: user?.user?.referenceId ?? '',
|
||||
caseId: allCases.selectedCaseId ?? '',
|
||||
caseId: selectedCaseId ?? '',
|
||||
page: getCurrentScreen()?.name,
|
||||
});
|
||||
return;
|
||||
@@ -36,7 +34,7 @@ const useScreenshotTracking = () => {
|
||||
return () => {
|
||||
if (screenshotTakenSubscription) screenshotTakenSubscription.remove();
|
||||
};
|
||||
}, [allCases?.selectedCaseId, user?.user?.referenceId]);
|
||||
}, [selectedCaseId, user?.user?.referenceId]);
|
||||
};
|
||||
|
||||
export default useScreenshotTracking;
|
||||
|
||||
@@ -23,21 +23,17 @@ import { VisitPlanStatus } from '../../reducer/userSlice';
|
||||
|
||||
export const CasesActionButtons: React.FC = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const {
|
||||
allCases: {
|
||||
newlyPinnedCases,
|
||||
selectedTodoListCount,
|
||||
selectedTodoListMap,
|
||||
casesList,
|
||||
caseDetails,
|
||||
visitPlansUpdating,
|
||||
pinnedList,
|
||||
},
|
||||
isLockedVisitPlanStatus,
|
||||
} = useAppSelector((state: RootState) => ({
|
||||
allCases: state.allCases,
|
||||
isLockedVisitPlanStatus: state.user?.lock?.visitPlanStatus === VisitPlanStatus.LOCKED,
|
||||
}));
|
||||
const isLockedVisitPlanStatus = useAppSelector(
|
||||
(state: RootState) => state.user?.lock?.visitPlanStatus === VisitPlanStatus.LOCKED
|
||||
);
|
||||
const newlyPinnedCases = useAppSelector((state) => state.allCases.newlyPinnedCases);
|
||||
const pinnedList = useAppSelector((state) => state.allCases.pinnedList);
|
||||
const selectedTodoListCount = useAppSelector((state) => state.allCases.selectedTodoListCount);
|
||||
const selectedTodoListMap = useAppSelector((state) => state.allCases.selectedTodoListMap);
|
||||
const casesList = useAppSelector((state) => state.allCases.casesList);
|
||||
const caseDetails = useAppSelector((state) => state.allCases.caseDetails);
|
||||
const visitPlansUpdating = useAppSelector((state) => state.allCases.visitPlansUpdating);
|
||||
|
||||
const isOnline = useIsOnline();
|
||||
|
||||
const currentRoute = useCurrentRoute();
|
||||
|
||||
@@ -23,13 +23,12 @@ export const getUnSyncedCase = (updatedCaseDetail: CaseDetail | undefined): any
|
||||
const interactionsHandler = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const isOnline = useIsOnline();
|
||||
const { allCasesDetails, docsToBeUploaded } = useAppSelector((state) => ({
|
||||
allCasesDetails: state.allCases.caseDetails,
|
||||
docsToBeUploaded: state.feedbackImages.docsToBeUploaded,
|
||||
}));
|
||||
const { templateId } = useAppSelector(
|
||||
(state) => state.case.templateData[CaseAllocationType.ADDRESS_VERIFICATION_CASE] || {}
|
||||
const allCasesDetails = useAppSelector((state) => state.allCases.caseDetails);
|
||||
const docsToBeUploaded = useAppSelector((state) => state.feedbackImages.docsToBeUploaded);
|
||||
const templateData = useAppSelector(
|
||||
(state) => state.case.templateData[CaseAllocationType.ADDRESS_VERIFICATION_CASE]
|
||||
);
|
||||
const { templateId } = templateData || {};
|
||||
|
||||
useEffect(() => {
|
||||
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.AV_NETWORK_STATUS_CHANGE, { isOnline });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Keyboard, SafeAreaView, View, StyleSheet, TouchableOpacity } from 'react-native';
|
||||
import { Keyboard, SafeAreaView, View, StyleSheet } from 'react-native';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import Text from '../../../RN-UI-LIB/src/components/Text';
|
||||
import TextInput, { TextInputMaskType } from '../../../RN-UI-LIB/src/components/TextInput';
|
||||
|
||||
@@ -7,7 +7,9 @@ import { useAppDispatch, useAppSelector } from '../../hooks';
|
||||
import CasesList from '../allCases/CasesList';
|
||||
|
||||
const FilteredCases = () => {
|
||||
const { pendingList, pinnedList, completedList } = useAppSelector((state) => state.allCases);
|
||||
const pendingList = useAppSelector((state) => state.allCases.pendingList);
|
||||
const pinnedList = useAppSelector((state) => state.allCases.pinnedList);
|
||||
const completedList = useAppSelector((state) => state.allCases.completedList);
|
||||
const caseType = useAppSelector((state) => state.agentPerformance?.filteredListToast?.caseType);
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
Reference in New Issue
Block a user