-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Memoize some functions in OptionsListUtils
#10239
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
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.
Is that bad? What does it mean? |
Not sure if this is related to this PR though? Does it also break on |
AFAIK npm changed its integrity checksum to sha512 so we should be using that going forward. Not sure if it's a bad thing or not, but we can be consistent and avoid changing this back and forth. I think updating npm and reinstalling the modules should fix this.
Ah this is just an observation that following the test steps on android result in that error. It also happens on main. |
Is the storage issue device level or an artificial limit we set in Onyx? |
I imagine this is some limit set in Onyx or SQLite, but I'm not 100% sure. I tried increasing both AsyncStorage_db_size_in_MB from 10MB to 1GB and I also see this in the console:
|
Chatted with Marc and the integrity changes in |
Fixed them! |
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.
LGTM, but package-lock is keeping it from being mergeable again 😢
I think we are good to merge once the conflicts are resolved |
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.
LGTM! Will be ready to approve again once conflicts are resolved
1ef1980
Memoize some functions in `OptionsListUtils` (cherry picked from commit c15c2e7)
@@ -70,6 +70,7 @@ | |||
"htmlparser2": "^7.2.0", | |||
"localforage": "^1.10.0", | |||
"lodash": "4.17.21", | |||
"memoize-one": "^6.0.0", |
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.
Out of curiosity, why did we choose to add a new lib instead of using _.memoize
: https://underscorejs.org/#memoize ?
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.
_.memoize
didn't work for me out of the box because it creates a hash from the first argument of the function (vs checking to see if all arguments are unique). memoize-one
"just worked" so I rolled with it instead of trying to figure out the hash function stuff.
🚀 Cherry-picked to staging by @luacmartins in version: 1.1.88-6 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
1 similar comment
🚀 Cherry-picked to staging by @luacmartins in version: 1.1.88-6 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
Details
Recalculating the Sidebar options when there are many reports is expensive and unnecessary. These long running functions contribute to some janky performance when reports are scaled up. Memoization can help reduce the number of recalculations that happen and unclog things a bit. But is not a final solution.
Fixed Issues (Related but does not completely solve)
#10248
Tests
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Screenshots
Web
Mobile Web
Desktop
iOS
Android