Skip to content

Commit

Permalink
fix: crash and profile not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
hurali97 committed Jan 31, 2024
1 parent e840080 commit da78bf0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ function getWorkspaceIcon(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> =
*/
function getIcons(
report: OnyxEntry<Report>,
personalDetails: OnyxCollection<PersonalDetails> = allPersonalDetails,
personalDetails: OnyxCollection<PersonalDetails>,
defaultIcon: UserUtils.AvatarSource | null = null,
defaultName = '',
defaultAccountID = -1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ function ReportActionCompose({
const isSendDisabled = isCommentEmpty || isBlockedFromConcierge || disabled || hasExceededMaxCommentLength;

const handleSendMessage = useCallback(() => {
'worklet';

if (isSendDisabled || !isReportReadyForDisplay) {
return;
}
Expand Down
14 changes: 11 additions & 3 deletions src/pages/home/report/ReportActionItemCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as ReportUtils from '@libs/ReportUtils';
import {navigateToConciergeChatAndDeleteReport} from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Policy, Report} from '@src/types/onyx';
import type {PersonalDetailsList, Policy, Report} from '@src/types/onyx';
import AnimatedEmptyStateBackground from './AnimatedEmptyStateBackground';

type ReportActionItemCreatedOnyxProps = {
Expand All @@ -24,6 +24,9 @@ type ReportActionItemCreatedOnyxProps = {

/** The policy object for the current route */
policy: OnyxEntry<Policy>;

/** Personal details of all the users */
personalDetails: OnyxEntry<PersonalDetailsList>;
};

type ReportActionItemCreatedProps = ReportActionItemCreatedOnyxProps & {
Expand All @@ -45,7 +48,7 @@ function ReportActionItemCreated(props: ReportActionItemCreatedProps) {
return null;
}

const icons = ReportUtils.getIcons(props.report);
const icons = ReportUtils.getIcons(props.report, props.personalDetails);
const shouldDisableDetailPage = ReportUtils.shouldDisableDetailPage(props.report);

return (
Expand Down Expand Up @@ -100,6 +103,10 @@ export default withOnyx<ReportActionItemCreatedProps, ReportActionItemCreatedOny
policy: {
key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
},

personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
},
})(
memo(
ReportActionItemCreated,
Expand All @@ -108,6 +115,7 @@ export default withOnyx<ReportActionItemCreatedProps, ReportActionItemCreatedOny
prevProps.policy?.avatar === nextProps.policy?.avatar &&
prevProps.report?.stateNum === nextProps.report?.stateNum &&
prevProps.report?.statusNum === nextProps.report?.statusNum &&
prevProps.report?.lastReadTime === nextProps.report?.lastReadTime,
prevProps.report?.lastReadTime === nextProps.report?.lastReadTime &&
prevProps.personalDetails === nextProps.personalDetails,
),
);

0 comments on commit da78bf0

Please sign in to comment.