API: Allow requesting subset of emoji list and cache list
- Dominant language
- JavaScript
- Stars
- 7
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
The `/api/emoji` endpoint to fetch the Slack emoji list, which is used by Scrapbook extensively (and possibly the events page soon if https://github.com/hackclub/events/pull/49 is merged), currently returns ~1.1MB of JSON. It isn't ideal to download this much data for use cases that only need a few emoji, and it's particularly impactful in cases like Scrapbook's where the entire list is downloaded for every emoji on the page. Currently, Scrapbook's repetitive downloads result in nearly 300MB of data transfers! This could be fixed by client-side caching, but I think a better solution would be to add an API route like `/api/emoji/[delimiter-separated emoji names]` or a parameter like `/api/emoji?filter=[names]`.
Furthermore, I noticed that Badger sends a request to `slack.com/api/emoji.list` for every invocation of this API route. Maybe this isn't an issue, but it may be best to cache results and throttle the Slack API calls.
I would be happy to make a PR for this if you would like!
Contributor guide
Assessment
This issue has not been assessed yet.