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

Context-menu repositioned #4194

Merged
merged 20 commits into from
Jul 28, 2021
Merged

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Jul 23, 2021

Details

Fixed Issues

$ fixes #4106

Tests | QA Steps

  1. Open E.cash.
  2. Check that the context menu is active on all platforms.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

I will update screenshots after the first code review.

Web

context.mp4

Mobile Web

Desktop

iOS

Android

@parasharrajat parasharrajat changed the title [WIP] Context-menu repositioned Context-menu repositioned Jul 25, 2021
@parasharrajat parasharrajat marked this pull request as ready for review July 25, 2021 20:35
@parasharrajat parasharrajat requested a review from a team as a code owner July 25, 2021 20:35
@MelvinBot MelvinBot requested review from marcaaron and removed request for a team July 25, 2021 20:35
@marcaaron marcaaron requested a review from a team July 27, 2021 02:23
@MelvinBot MelvinBot removed the request for review from a team July 27, 2021 02:23
@marcaaron marcaaron requested review from a team and removed request for marcaaron July 27, 2021 02:24
@MelvinBot MelvinBot requested review from marcaaron and removed request for a team July 27, 2021 02:24
@marcaaron
Copy link
Contributor

I guess this is me. I was hoping to have someone else give this an initial review. @roryabraham are you available to help ?

@marcaaron
Copy link
Contributor

@parasharrajat Are you able to add some benchmarks to the description? 🙏
This is supposed to improve performance of chat switching. I am curious to see if it will.

@parasharrajat parasharrajat mentioned this pull request Jul 27, 2021
5 tasks
@parasharrajat
Copy link
Member Author

I am not sure on How exactly we record that? but I'll try. I saw that you posted some stats on the issue, I'll take that as a reference.

@roryabraham
Copy link
Contributor

@marcaaron I can help review 😄

@roryabraham
Copy link
Contributor

Also @parasharrajat conflicts

@roryabraham roryabraham self-requested a review July 27, 2021 16:01
@marcaaron
Copy link
Contributor

When the delete modal will show we have to update the state isDeleteModalVisible which will cause the re-render of the list. Also, DeleteModal is linked with ContextMenu which is handled well together. If we move this out, we have to pass more callbacks here and there.

Ok cool, let's skip my suggestion for now. It will add more complexity to what is already pretty complex changes.

@marcaaron
Copy link
Contributor

Testing is going really well @parasharrajat

I have built the PR on Android in release mode and seeing a reduction in chat switching times of about 0.7 seconds.

The metrics on dev are probably inflated a bit as release builds are more efficient in general but that is still a HUGE improvement.

@parasharrajat
Copy link
Member Author

Yeah. Release build will be faster.

marcaaron
marcaaron previously approved these changes Jul 28, 2021
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me. I'm gonna test this on web and iOS next, but maybe @roryabraham can do a last review. Let's get this merged!!

if (!props.isVisible) {
return {isVisible: false};
}
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we can maybe try to improve this in a follow up I don't have a better suggestion at the moment.

});
}

isActiveReportAction(actionID) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing JS doc

if (!contextMenuRef.current) {
return;
}
return contextMenuRef.current.hideDeleteModal();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB, is there some reason we are returning this function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, It must have been left unintentionally. Only isActiveReportAction needs return value. I will update it.

@marcaaron
Copy link
Contributor

Savings on iOS release builds are less significant, but still really good with an averages of 233 ms in my most recent test.

roryabraham
roryabraham previously approved these changes Jul 28, 2021
Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking better, only a few minor NAB code style comments at this point.

import {hideContextMenu, showDeleteModal} from './ReportActionContextMenu';

/**
* Gets the markdown version of the message in an action.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB:

Suggested change
* Gets the markdown version of the message in an action.
* Gets the HTML version of the message in an action.

* @param {Number} reportID - Active Report Id
* @param {Object} reportAction - ReportAction for ContextMenu
* @param {String} draftMessage - ReportAction Draftmessage
* @param {Function} [onShow=() => {}] - Run a callback when Menu is shown
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB this is weird:

Suggested change
* @param {Function} [onShow=() => {}] - Run a callback when Menu is shown
* @param {Function} [onShow] - Run a callback when Menu is shown

* @param {Object} reportAction - ReportAction for ContextMenu
* @param {String} draftMessage - ReportAction Draftmessage
* @param {Function} [onShow=() => {}] - Run a callback when Menu is shown
* @param {Function} [onHide=() => {}] - Run a callback when Menu is hidden
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {Function} [onHide=() => {}] - Run a callback when Menu is hidden
* @param {Function} [onHide] - Run a callback when Menu is hidden

});
}

runAfterContextMenuHide() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB because both names are bad:

Suggested change
runAfterContextMenuHide() {
runAndResetOnPopoverHide() {


// We use a combination of sequenceNumber and clientID in case the clientID are the same - which
// shouldn't happen, but might be possible in some rare cases.
// eslint-disable-next-line react/jsx-props-no-multi-spaces
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump – reasonably certain we don't need this eslint-disable

if (!props.isVisible) {
return {isVisible: false};
}
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to leave a code comment explaining this.

@parasharrajat
Copy link
Member Author

// eslint-disable-next-line react/jsx-props-no-multi-spaces is needed due to the comment over the keyExtractor prop. What if I move this comment on the function definition itself. Will it be fine?

@parasharrajat parasharrajat dismissed stale reviews from roryabraham and marcaaron via bec3d56 July 28, 2021 22:29
@parasharrajat
Copy link
Member Author

Changes done. Please review.

@marcaaron marcaaron merged commit 0b6263b into Expensify:main Jul 28, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@marcaaron
Copy link
Contributor

There's a problem with this PR on web. We need to remove this code I think as the method was renamed maybe?

this.runAfterContextMenuHide = this.runAfterContextMenuHide.bind(this);

@parasharrajat parasharrajat mentioned this pull request Jul 29, 2021
@parasharrajat
Copy link
Member Author

parasharrajat commented Jul 29, 2021

#4297 for a fix.

There is one more thing that is throwing a warning. forwardedRef prop type on WithLocalize. I don't know what type to pass, Seems correct to me.

@marcaaron
Copy link
Contributor

I am unsure myself, but also see the error..

2021-07-29_05-46-31

@OSBotify
Copy link
Contributor

🚀 Deployed to staging in version: 1.0.81-5🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Aug 6, 2021

🚀 Deployed to production in version: 1.0.82-7🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Performance] [Audit] ReportActionContextMenu slows down cell rendering time significantly
4 participants