-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix Desktop - CMD + K is slow and laggy #3601 #3760
Fix Desktop - CMD + K is slow and laggy #3601 #3760
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA. |
src/components/OptionsSelector.js
Outdated
filterAdapter: PropTypes.func, | ||
getCustomHeaderMessage: PropTypes.func, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each prop needs a comment
src/components/OptionsSelector.js
Outdated
@@ -207,12 +214,12 @@ class OptionsSelector extends Component { | |||
ref={el => this.list = el} | |||
optionHoveredStyle={styles.hoveredComponentBG} | |||
onSelectRow={this.selectRow} | |||
sections={this.props.sections} | |||
sections={this.state.sections || this.props.sections} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just initialize the state with the sections from props?
src/components/OptionsSelector.js
Outdated
focusedIndex={this.state.focusedIndex} | ||
selectedOptions={this.props.selectedOptions} | ||
canSelectMultipleOptions={this.props.canSelectMultipleOptions} | ||
hideSectionHeaders={this.props.hideSectionHeaders} | ||
headerMessage={this.props.headerMessage} | ||
headerMessage={headerMessage} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need a separate variable for this, let's just put this.props.getCustomHeaderMessage(this.searchValue)
here
@@ -62,11 +59,10 @@ class SearchPage extends Component { | |||
constructor(props) { | |||
super(props); | |||
|
|||
Timing.start(CONST.TIMING.SEARCH_RENDER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still want the Timing I believe, can we get this added back but maybe put where it belongs now?
src/pages/SearchPage.js
Outdated
// eslint-disable-next-line no-console | ||
console.log('lazyLoad', this.state.readyToLoad); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't still need this log line
src/pages/SearchPage.js
Outdated
? ( | ||
<Text> | ||
... | ||
</Text> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely don't want to show the ...
text when the screen is loading, we should either show a loading indicator here or just leave it like how it was before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed log again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated everything you asked.
I updated everything as you asked. |
src/components/Looxor
Outdated
Looxor | ||
MyNameIsJin08011952l. | ||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think you want this file in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it.
It was made by my mistake when I create a token file by reading a tutorial of my friend. Sorry.
src/components/OptionsSelector.js
Outdated
/** Function to get a filtered result as list */ | ||
filterAdapter: PropTypes.func, | ||
/** FUnction to get header message from parent component */ | ||
getCustomHeaderMessage: PropTypes.func, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line before each comment, also a typo with FUnction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added them.
src/pages/SearchPage.js
Outdated
!didScreenTransitionEnd | ||
? null | ||
: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just make this {({didScreenTransitionEnd}) => (
and remove the null conditional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I removed it.
} | ||
|
||
componentDidMount() { | ||
Timing.end(CONST.TIMING.SEARCH_RENDER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timing isn't getting ended so this will just be an infinite timer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added it. Sorry for forgetting.
src/components/OptionsSelector.js
Outdated
/** Function to get a filtered result as list */ | ||
filterAdapter: PropTypes.func, | ||
|
||
/** FUnction to get header message from parent component */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo with FUnction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, updated. Sorry for typo
src/pages/SearchPage.js
Outdated
this.recentReports = recentReports; | ||
this.personalDetails = personalDetails; | ||
this.userToInvite = userToInvite; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't these need to be left in state so this can re-render with changes to these values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that the SearchPage needs to re-render when updating props, but just found Onyx component wrapper.
Ok, I will change that to use this.props. (recentReports, personDetails, userToInvite)
src/pages/SearchPage.js
Outdated
* @param {String} searchValue | ||
* @returns {Array} | ||
*/ | ||
filterAdapter(searchValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confused at why this is called filterAdapter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding this, honestly, I was also confused because I am not sure which type of design pattern is preferred in this project.
I renamed it to searchSections.
But, if it is not good, can you please recommend one?
src/pages/SearchPage.js
Outdated
* @returns {Array} | ||
*/ | ||
getSections() { | ||
return this.filterAdapter(''); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to rename this method / update the comment now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed it to searchSections.
Thank you for your time to fix my mistakes on updating codes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for making all these changes! It's looking good
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging in version: 1.0.74-1🚀
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR has caused a regression #3818.
<OptionsSelector | ||
sections={sections} | ||
onSelectRow={this.selectReport} | ||
searchSections={this.searchSections} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prop needs to be passed to other pages where this component is used. Otherwise, Search will not work there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, do you mean to use this.props.sections?
It makes multiple-rendering as I explained here.
#3601 (comment)
hideSectionHeaders | ||
hideAdditionalOptionStates | ||
showTitleTooltip | ||
didScreenTransitionEnd && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didScreenTransitionEnd
was moved up? I mean we didn't want to hide the header of the page behind the loader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I put didScreenTransitionEnd
, I found that CMD+K is much faster.
But, if needed, I will put it back.
Details
Fixed Issues
$ #3601
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
expensify-fix-result.mp4
iOS
Android
I have read the CLA Document and I hereby sign the CLA.