Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

ABC-92 Add paging and server search for custom emojis to emoji picker #657

Merged
merged 4 commits into from
Feb 2, 2018

Conversation

jwilander
Copy link
Member

Summary

Add paging and server search for custom emojis to emoji picker.

@hmhealey @stephenkiers let me know if I should approach this differently. This is my first time in the emoji picker code and it's a bit complex, so if you guys have better ideas on how to do this let me know :)

Ticket Link

https://mattermost.atlassian.net/browse/ABC-92

Checklist

@jwilander jwilander added 1: PM Review Requires review by a product manager 2: Dev Review Requires review by a core commiter labels Jan 24, 2018
@jwilander jwilander added this to the v4.7.0 milestone Jan 24, 2018
@jwilander jwilander added Setup Old Test Server Triggers the creation of a test server and removed Setup Old Test Server Triggers the creation of a test server labels Jan 24, 2018
@mattermost mattermost deleted a comment from mattermod Jan 24, 2018
@mattermost mattermost deleted a comment from mattermod Jan 24, 2018
@mattermost mattermost deleted a comment from mattermod Jan 24, 2018
@jwilander jwilander added the Setup Old Test Server Triggers the creation of a test server label Jan 24, 2018
@jwilander
Copy link
Member Author

@jasonblais I loaded a bunch of emojis and it should be ready for testing

Copy link
Contributor

@jasonblais jasonblais left a comment

Choose a reason for hiding this comment

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

@jwilander As discussed briefly as an option yesterday, can we make a slight change where the next page of emojis load before you hit the end of the previous page?

image

Right now it looks like there are no more emoji at the bottom once you've scrolled down.

I'm 0/5 on how early we start loading without trying it out. Perhaps once you've reached the last 50 on the page (half of the emoji picker UI), we load the next 200?

@jwilander
Copy link
Member Author

Yep, I'll make that change

@jasonblais jasonblais self-assigned this Jan 25, 2018
@jwilander jwilander removed the Setup Old Test Server Triggers the creation of a test server label Jan 26, 2018
@mattermost mattermost deleted a comment from mattermod Jan 26, 2018
@mattermost mattermost deleted a comment from mattermod Jan 26, 2018
@mattermost mattermost deleted a comment from mattermod Jan 26, 2018
@mattermod
Copy link
Contributor

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

@jwilander jwilander added the Setup Old Test Server Triggers the creation of a test server label Jan 26, 2018
@mattermod
Copy link
Contributor

Spinmint test server created at: http:https://i-06133eee40c5f4919.spinmint.com

Test Account 1: Email: [email protected] | Password: passwd

Test Account 2: Email: [email protected] | Password: passwd

Instance ID: i-06133eee40c5f4919

@jwilander
Copy link
Member Author

@jasonblais this one is ready too

Copy link
Contributor

@jasonblais jasonblais left a comment

Choose a reason for hiding this comment

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

Performance-wise it feels better compared to current master. Scrolling through the picker feels smooth.

@jwilander Not related to this PR, but I get a blank screen initially when I switch to the custom emoji category on the picker (same as on master). Anything we can do there to improve it,
perhaps a loading screen?

@hmhealey @stephenkiers ready for your review.

@jasonblais jasonblais removed the 1: PM Review Requires review by a product manager label Jan 30, 2018
@jasonblais jasonblais removed their assignment Jan 30, 2018
@stephenkiers
Copy link
Contributor

2 Questions:

  1. I noticed that emojis aren't being loaded in the center window until they are loaded via the emoji picker. Is that simply because the other PR isn't in this one? Or is it a bug? See : https://www.youtube.com/watch?v=AMFTA_YKYko
  2. are we saving the emojis in local storage once loaded so they aren't reloaded every time?

@stephenkiers
Copy link
Contributor

I feel like this component group needs to be split into multiple, simpler components that do one thing each. However that is another task in and of itself.
I thought your approach looked good and seems to work good. :)

Copy link
Contributor

@stephenkiers stephenkiers left a comment

Choose a reason for hiding this comment

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

I am approving in the assumption that the bug I put in the comment above is simply because the other related PR isn't loaded yet.

@jwilander
Copy link
Member Author

jwilander commented Jan 30, 2018

  1. Yes, that's just because the other PR hasn't been merged yet and I disabled the load all emoji on page load functionality for testing this PR (will revert that before merging)
  2. No, currently we only store a few things in local storage right now. Agreed though, it is something we should look at in the future

@jwilander
Copy link
Member Author

@jasonblais is this just before the custom emojis load in? If so yeah we can definitely add a loading indicator but I think there's still going to be some delay between that disappearing and the emojis loading in to cover the gap of time between when the getting metadata request completes and the get emoji images requests start going out. We could do a bunch of refactoring to make that gap not exist (at least from the user's perspective) but that's a lot more work

@jasonblais
Copy link
Contributor

jasonblais commented Jan 30, 2018

@jwilander I see that with the system emoji too. If I click on a category, the emoji picker is just blank, after which the emoji appear.

image

Should I just create a ticket to look into it?

@jwilander
Copy link
Member Author

Oh interesting.. I guess that's just waiting for the images to load in. Yeah I'd say that's another ticket

@jasonblais
Copy link
Contributor

@stephenkiers
Copy link
Contributor

That should be easy to fix. I will take that one next sprint.

Copy link
Member

@hmhealey hmhealey left a comment

Choose a reason for hiding this comment

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

Looks good unless we have a batched API for getting emojis that I don't know about

const missingEmojis = recentEmojis.filter((name) => !emojiMap.has(name));

missingEmojis.forEach((name) => {
EmojiActions.getCustomEmojiByName(name)(dispatch, getState);
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if we had a bulk API for this. As it is, we're making up to 27 requests for this

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I agree, with this there will be caching by both the proxy and the browser. With a bulk request it's going to always go the whole way to the server

Copy link
Member Author

@jwilander jwilander Jan 31, 2018

Choose a reason for hiding this comment

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

The ABC team does have a ticket to look into which is really better and when but using the force I think it's going to be better to have more individual GETs most of the time
https://mattermost.atlassian.net/browse/ABC-163

@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {Overlay} from 'react-bootstrap';

import EmojiPicker from './emoji_picker.jsx';
import EmojiPicker from './';
Copy link
Member

Choose a reason for hiding this comment

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

This import state looks really weird to me, but it makes sense without moving a bunch of files around

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it weirded me out a bit but I didn't want to have to go rearrange a bunch of files

package.json Outdated
@@ -27,7 +27,7 @@
"localforage": "1.5.6",
"localforage-observable": "1.4.0",
"marked": "mattermost/marked#802e981ade71149a497cbe79d12b8a3f82f7657e",
"mattermost-redux": "mattermost/mattermost-redux",
"mattermost-redux": "mattermost/mattermost-redux#abc-92-no-emoji",
Copy link
Member

Choose a reason for hiding this comment

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

Is this supposed to be changed here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It was while we were testing, I'll update it back to normal

@hmhealey hmhealey added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Feb 2, 2018
@jwilander jwilander removed the Setup Old Test Server Triggers the creation of a test server label Feb 2, 2018
@jwilander jwilander merged commit 6f9fa7b into master Feb 2, 2018
@jwilander jwilander deleted the abc-92 branch February 2, 2018 17:13
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation labels Feb 2, 2018
@lindalumitchell lindalumitchell added the Tests/Done Release tests have been written label Feb 15, 2018
hmhealey pushed a commit that referenced this pull request Aug 28, 2020
hmhealey pushed a commit that referenced this pull request Mar 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation Tests/Done Release tests have been written
Projects
None yet
7 participants