Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: optimise composer send behaviour #30168

Merged
merged 97 commits into from
Jan 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
00a7c23
perf: memoize components
hurali97 Oct 23, 2023
9c4f299
refactor: simplify props
hurali97 Oct 23, 2023
75ad613
perf: reduce re-renders
hurali97 Oct 23, 2023
d242e35
refactor: make action prop lightweight
hurali97 Oct 24, 2023
33239a6
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Oct 25, 2023
828b4eb
perf: add Interaction Manager
hurali97 Oct 25, 2023
60d3034
perf: reference bindings of functions
hurali97 Oct 25, 2023
851c61f
perf: optimise rendering
hurali97 Oct 26, 2023
e613f42
perf: optimise usage of personal detail list
hurali97 Oct 26, 2023
47c4717
fix: linting
hurali97 Oct 26, 2023
18428c1
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Oct 27, 2023
9562e8c
refactor: remove not needed code
hurali97 Oct 27, 2023
ad1b337
fix: linting and test
hurali97 Oct 27, 2023
9a27bed
fix: failing unread indicator test
hurali97 Oct 27, 2023
9f29436
fix: prettier issues
hurali97 Oct 27, 2023
352227f
fix: failing test
hurali97 Oct 27, 2023
23537f5
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Oct 30, 2023
5d0f32b
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 6, 2023
3820a45
fix: reassure failures reported
hurali97 Nov 6, 2023
ddf53d3
fix: reported reassure issues
hurali97 Nov 7, 2023
60be54d
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 7, 2023
5e2f21f
fix: reported reassure issues
hurali97 Nov 7, 2023
70eaf12
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 9, 2023
684ddda
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 13, 2023
46c9d60
fix: pr review
hurali97 Nov 13, 2023
21ee749
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 15, 2023
83d823e
fix: add default value
hurali97 Nov 16, 2023
1856820
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 17, 2023
36eaa4e
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 27, 2023
83f6bf1
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 28, 2023
67c1c0e
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 29, 2023
a7130f0
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Nov 30, 2023
fbf2729
fix: appropriate arguments to getDisplayNameOrDefault
hurali97 Nov 30, 2023
1d115c0
fix: workspace unavailable avatar
hurali97 Nov 30, 2023
3b98178
fix: pass policy instead of policies to getIcons
hurali97 Nov 30, 2023
ae3d7fe
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 1, 2023
33703b3
test: fix failing caledarpickertest due to an edge case of last month…
hurali97 Dec 1, 2023
ae6f7d2
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 1, 2023
ad2549a
fix: personal details not updating
hurali97 Dec 4, 2023
d5c837d
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 4, 2023
a99d653
fix: personalDetails not updating
hurali97 Dec 6, 2023
d9eda10
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 6, 2023
b1257f5
fix: ts issues
hurali97 Dec 6, 2023
21749f1
fix: personaldetails not updating
hurali97 Dec 7, 2023
411b92c
fix: personalDetails not updating in AnonymousReportFooter
hurali97 Dec 7, 2023
55c900f
refactor: cleanup
hurali97 Dec 7, 2023
d8c895a
refactor: cleanup
hurali97 Dec 7, 2023
3036ef8
refactor: move personalDetails to LHNOptionsList
hurali97 Dec 7, 2023
18cd5fe
fix: typescript issues
hurali97 Dec 7, 2023
65d25e8
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 11, 2023
3ff28a2
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 12, 2023
f896fc6
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 12, 2023
72a93b9
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 14, 2023
1296484
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 15, 2023
36bfec3
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 15, 2023
259a121
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 18, 2023
87e0d93
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 19, 2023
c632b7c
fix: typecheck for AvatarWithDisplayName
hurali97 Dec 19, 2023
77d273e
fix: linting
hurali97 Dec 19, 2023
de41fd0
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 21, 2023
3deb210
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 22, 2023
d8d2208
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 27, 2023
c404896
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 28, 2023
2facb91
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Dec 29, 2023
4f7cf26
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 3, 2024
d74c3aa
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 4, 2024
b3e6f68
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 4, 2024
048b8a6
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 8, 2024
c3fd89f
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 9, 2024
b215c84
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 10, 2024
15ba306
fix: paste not working on web
hurali97 Jan 10, 2024
1ab6e19
fix: compose height on mobile
hurali97 Jan 11, 2024
f45a0aa
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 11, 2024
1139e31
fix: revert platform specific styles
hurali97 Jan 11, 2024
2c6f73a
fix: extra compose height
hurali97 Jan 11, 2024
53bb609
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 15, 2024
48a0d83
fix: reply not shown
hurali97 Jan 16, 2024
c66e571
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 16, 2024
baf9b3e
fix: add missing reportAction properties
hurali97 Jan 17, 2024
e2b24a0
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 17, 2024
83a7bc2
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 17, 2024
470eb7b
fix: hide reply and task welcome message and add the missing fields
hurali97 Jan 18, 2024
efd81f5
refactor: remove not used prop
hurali97 Jan 18, 2024
f1bbd1d
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 19, 2024
722910d
fix: local time not displayed
hurali97 Jan 19, 2024
348d33a
refactor: move memoized report object to report screen
hurali97 Jan 19, 2024
d233cbb
fix: composer not being auto focused
hurali97 Jan 24, 2024
16c0ad6
refactor: remove not needed code change
hurali97 Jan 24, 2024
ddb5ef6
fix: linting
hurali97 Jan 24, 2024
17a5cda
fix: reassure tests
hurali97 Jan 24, 2024
3943fa4
refactor: add prop types
hurali97 Jan 24, 2024
1eccb29
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 25, 2024
a172b68
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 26, 2024
336a0a3
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 30, 2024
e840080
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 30, 2024
da78bf0
fix: crash and profile not updating
hurali97 Jan 31, 2024
d2e771d
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
hurali97 Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' of https://github.com/hurali97/Expensify-App into…
… perf/optimise-composer-send
  • Loading branch information
hurali97 committed Nov 28, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 83f6bf1d996565ceceee2eb4a26c5600704afee4
69 changes: 27 additions & 42 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
@@ -1116,24 +1116,14 @@ function getReportRecipientAccountIDs(report: OnyxEntry<Report>, currentLoginAcc

/**
* Whether the time row should be shown for a report.
* @param {Object} report
* @return {Boolean}
*/
function canShowReportRecipientLocalTime(report) {
const reportRecipientAccountIDs = getReportRecipientAccountIDs(report, currentUserAccountID);
function canShowReportRecipientLocalTime(report: OnyxEntry<Report>, accountID: number): boolean {
const reportRecipientAccountIDs = getReportRecipientAccountIDs(report, accountID);
const hasMultipleParticipants = reportRecipientAccountIDs.length > 1;
const reportRecipient = allPersonalDetails[reportRecipientAccountIDs[0]];
const reportRecipientTimezone = lodashGet(reportRecipient, 'timezone', CONST.DEFAULT_TIME_ZONE);
const isReportParticipantValidated = lodashGet(reportRecipient, 'validated', false);
return Boolean(
!hasMultipleParticipants &&
!isChatRoom(report) &&
!isPolicyExpenseChat(report) &&
reportRecipient &&
reportRecipientTimezone &&
reportRecipientTimezone.selected &&
isReportParticipantValidated,
);
const reportRecipient = allPersonalDetails?.[reportRecipientAccountIDs[0]];
const reportRecipientTimezone = reportRecipient?.timezone ?? CONST.DEFAULT_TIME_ZONE;
const isReportParticipantValidated = reportRecipient?.validated ?? false;
return Boolean(!hasMultipleParticipants && !isChatRoom(report) && !isPolicyExpenseChat(report) && reportRecipient && reportRecipientTimezone?.selected && isReportParticipantValidated);
}

/**
@@ -1174,20 +1164,16 @@ function getWorkspaceAvatar(report: OnyxEntry<Report>): UserUtils.AvatarSource {
/**
* Returns the appropriate icons for the given chat report using the stored personalDetails.
* The Avatar sources can be URLs or Icon components according to the chat type.
*
* @param {Array} participants
* @param {Object} passedPersonalDetails
* @returns {Array<*>}
*/
function getIconsForParticipants(participants, passedPersonalDetails) {
const participantDetails = [];
function getIconsForParticipants(participants: number[], passedPersonalDetails: OnyxCollection<PersonalDetails>): Icon[] {
const participantDetails: ParticipantDetails[] = [];
const participantsList = participants || [];
const personalDetails = passedPersonalDetails || allPersonalDetails;
for (let i = 0; i < participantsList.length; i++) {
const accountID = participantsList[i];
const avatarSource = UserUtils.getAvatar(lodashGet(personalDetails, [accountID, 'avatar'], ''), accountID);
const displayNameLogin = lodashGet(personalDetails, [accountID, 'displayName']) || lodashGet(personalDetails, [accountID, 'login'], '');
participantDetails.push([accountID, displayNameLogin, avatarSource, lodashGet(personalDetails, [accountID, 'fallBackIcon'])]);
const personalDetails = passedPersonalDetails ?? allPersonalDetails;

for (const accountID of participantsList) {
const avatarSource = UserUtils.getAvatar(personalDetails?.[accountID]?.avatar ?? '', accountID);
const displayNameLogin = personalDetails?.[accountID]?.displayName ? personalDetails?.[accountID]?.displayName : personalDetails?.[accountID]?.login;
participantDetails.push([accountID, displayNameLogin ?? '', avatarSource, personalDetails?.[accountID]?.fallbackIcon ?? '']);
}

const sortedParticipantDetails = participantDetails.sort((first, second) => {
@@ -1241,26 +1227,25 @@ function getWorkspaceIcon(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> =
/**
* Returns the appropriate icons for the given chat report using the stored personalDetails.
* The Avatar sources can be URLs or Icon components according to the chat type.
*
* @param {Object} report
* @param {*} [defaultIcon]
* @param {String} [defaultName]
* @param {Number} [defaultAccountID]
* @param {Object} [policy]
* @param {Object} passedPersonalDetails
* @returns {Array<*>}
*/
function getIcons(report, defaultIcon = null, defaultName = '', defaultAccountID = -1, policy = undefined, passedPersonalDetails = allPersonalDetails) {
const personalDetails = passedPersonalDetails;
if (_.isEmpty(report)) {
const fallbackIcon = {
source: defaultIcon || Expensicons.FallbackAvatar,
*/
function getIcons(
report: OnyxEntry<Report>,
defaultIcon: UserUtils.AvatarSource | null = null,
defaultName = '',
defaultAccountID = -1,
policy: OnyxEntry<Policy> = null,
passedPersonalDetails: OnyxCollection<PersonalDetails> = allPersonalDetails,
): Icon[] {
if (isEmptyObject(report)) {
const fallbackIcon: Icon = {
source: defaultIcon ?? Expensicons.FallbackAvatar,
type: CONST.ICON_TYPE_AVATAR,
name: defaultName,
id: defaultAccountID,
};
return [fallbackIcon];
}
const personalDetails = passedPersonalDetails;
if (isExpenseRequest(report)) {
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
const workspaceIcon = getWorkspaceIcon(report, policy);
2 changes: 1 addition & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable rulesdir/prefer-underscore-method */
import Str from 'expensify-common/lib/str';
import Onyx, {OnyxEntry} from 'react-native-onyx';
import Onyx, {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import {ValueOf} from 'type-fest';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ function SuggestionMention({
* hence we don't have to use it with `withOnyx`.
*/
const personalDetails = PersonalDetailsUtils.getPersonalDetails();
const {translate} = useLocalize();
const {translate, formatPhoneNumber} = useLocalize();
const previousValue = usePrevious(value);
const [suggestionValues, setSuggestionValues] = useState(defaultSuggestionsValues);

You are viewing a condensed version of this merge commit. You can view the full changes here.