-
Notifications
You must be signed in to change notification settings - Fork 89
Use map for keeping pending promises #365
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
Use map for keeping pending promises #365
Conversation
| * @type {Record<string, Promise>} | ||
| */ | ||
| this.pendingPromises = {}; | ||
| this.pendingPromises = new Map(); |
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.
Could you update the docs above and leave a comment why we chose to use Map?
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 can take care of that
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.
What do you mean with the docs though? Docs are only generated from onyx.js, and not from other internal implementation files such as this one
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.
@type {Record<string, Promise>} I meant this
mountiny
left a comment
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.
Thanks!
Map is faster than object when we have a lot of items. Using map in this place seems to improve chat switching performance.
Details
Related Issues
GH_LINK
Automated Tests
Linked PRs