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
[wip] popovers: rendering the emoji picker only once. #4301
Conversation
Automated message from Dropbox CLA bot @tejaskasetty, it looks like you've already signed the Dropbox CLA. Thanks! |
This also would be a way for progress on #1956 . Which deals with improvement in performance of emoji picker, which I have been working on parallely. |
Hi @tejaskasetty, can you fix the commit messages to conform to our guidelines here?: https://zulip.readthedocs.io/en/latest/version-control.html#commit-messages |
yeah sure. |
The thing is, I would like to just submit one proper commit. The multiple commits that i submitted were because it initially didn't pass the Travis CI build. How can i do that? I m really sorry, I should have read the commit discipline. Now i know how to write a proper commit message. And also I m still getting familiarized with git. |
@tejaskasetty, It is very common for contributors to have issues understanding git, so please don't worry, we're here to help. In order to squash your commits into one proper commit, you will want to learn how to do an interactive rebase. If you go on to the "development help" stream on chat, there should be multiple folks that can walk you through this, although expect some delay for help during the weekend. |
Hello @zulip/server-emoji members, this pull request references an issue with the "area: emoji" label, so you may want to check it out! |
Thanks a lot. It was very informative. Got to learn more about Git. By the way, how is the updated commit. Is this according to the guidelines? |
static/js/popovers.js
Outdated
@@ -519,10 +521,14 @@ exports.register_click_handlers = function () { | |||
if (emoji_map_is_open) { | |||
// If the popover is already shown, clicking again should toggle it. | |||
popovers.hide_emoji_map_popover(); | |||
return; | |||
} else { // popovers.hide_all(); |
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 want to remove the above 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.
Yeah. I kept it so that it would remind me to check areas like this, where there has been unwanted calls to hide all popovers. so they I could understand them. so that i could optimize other areas like this as well. I forgot to remove it later.
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 don't think that it is an unwanted call. Purpose of this call is to hide other popovers like message actions popover, if they are open before opening the emoji picker popover. I think you should add it back.
The code here looks pretty straightforward, and I appreciate the detail of the commit message. I'd like to reword the first line of the commit message a bit. Since we have two different emoji pickers, and I believe this is for the compose box, say this: |
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.
@tejaskasetty It is looking good but I think it is still not complete yet. You need to re-render the emoji pickers in case a realm emoji is added/deleted as pointer out by Tim! :)
@HarshitOnGitHub yeah you are right. I will add that case and submit. |
@showell. I ll change commit header. Actually, I m also working on unifying the two different emoji pickers as well. I m going through the code base to get the ideas of all the places where this occurs. Going through the code base is taking a bit of time. Once i cover all the related files, i will start of with that too. |
I added "wip" to the PR title to indicate this is still a work in progress. |
okay |
@tejaskasetty can you resolve the outstanding feedback and let us know when this is ready for review? |
I m really sorry, for the delay. I was checking through the server side code for - "How the case of updating a
this case would be triggered. So, i didn't have to change/add anything on the server side. |
Sorry accidently closed it |
Coming back to the issue, the mistake was i thought it was not handled on the server side. So, simply went through a lot of server side code. |
It looks like you need to fix the node test for You can run I'm not sure about the other Travis errors--they may have been flakes unrelated to your changes. |
@showell I have made the correction in |
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.
Left a few comments and please have proper capitalization and punctuation in your commit messages, otherwise looking good to me. :)
static/js/popovers.js
Outdated
@@ -380,6 +380,10 @@ function user_sidebar_popped() { | |||
return current_user_sidebar_popover !== undefined; | |||
} | |||
|
|||
exports.reset_emoji_map_is_rendered = 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.
Minor but I would call it something like reset_emoji_popover()
.
static/js/emoji.js
Outdated
@@ -29,6 +29,7 @@ exports.emoji_name_to_css_class = function (emoji_name) { | |||
|
|||
exports.update_emojis = function update_emojis(realm_emojis) { | |||
// Copy the default emoji list and add realm-specific emoji to it | |||
exports.realm_emojis = {}; |
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.
You can add a comment here explaining why this is needed.
@HarshitOnGitHub Thanks, for the review. I made the changes. And updated the commit messages. I'll be careful about these aspects in future commits. |
* Whenever the emoji picker is opened a call is made to render the emoji's. This rendering happend everytime the emoji picker was opened. Thus, resulting in duplicates of emoji's getting appended in the emoji picker over multiple open and close. * This commit, is a fix to render the emoji's only once when the emoji picker is opened for the first time. Further calls just toggles the emoji picker showing the already rendered emoji's. This enhances the performance of Emoji picker considerably because there is no overhead of making a request to get the emoji's from the server, each time the emoji picker is opened. * Other changes -- on closing the emoji picker, the compose box remains in focus. Fixes: #4300. See Also: #3952.
@tejaskasetty It seems from the last commit that you used the merge branches workflow whereas Zulip prefers |
yeah I realized that. So, finished rebasing will push it to my remote branch now. |
* reset the emoji popover in case of an event regarding update of realm_emoji. * test-node-with-js: Add dependency - popovers module; In dispath.js to support popovers object.
Nice, this version is really clean. Merged, thanks @tejaskasetty! |
Fix to #4300
The rendering of emoji for the emoji picker is made only once when the emoji Picker UI is first used.
Rest of the requests just toggles the already rendered emoji picker.
Notable changes - Earlier when ever the emoji picker was closed the focus on the compose text box would be removed. In this commit, when the emoji picker is closed the compose text box remains in focus. And this happens also when we open the emoji picker. This change will be reverted back if not needed.
Observations - There are other areas like this if corrected can improve the efficiency of the emoji picker UI on the frontend. I will look for them and work on improving them.