Skip to content

refactor: remove emoji-datasource from dependcies#7174

Open
i1skn wants to merge 1 commit into02-24-chore_add_test_for_places_where_we_use_emojisfrom
02-24-refactor_remove_emoji-datasource_from_dependcies
Open

refactor: remove emoji-datasource from dependcies#7174
i1skn wants to merge 1 commit into02-24-chore_add_test_for_places_where_we_use_emojisfrom
02-24-refactor_remove_emoji-datasource_from_dependcies

Conversation

@i1skn
Copy link
Contributor

@i1skn i1skn commented Feb 24, 2026

Description

emoji-datasource was only being used as a static source for emoji lookups and avatar picker data, but it adds unnecessary dependency, which results into additional 0.96Mb for bundle size.

This PR replaces that dependency with a compact in-repo emoji catalog (emojiByName + avatarEmojis) so emoji resolution and avatar selection keep the same behavior while cutting the large JSON dataset and removing the external package.

As a result of these changes the bundle size is decreased by 0.96Mb!

Copy link
Contributor Author

i1skn commented Feb 24, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@i1skn i1skn force-pushed the 02-24-refactor_remove_emoji-datasource_from_dependcies branch 4 times, most recently from 3132ee7 to edd2a9e Compare February 24, 2026 15:36
@i1skn i1skn force-pushed the 02-24-chore_add_test_for_places_where_we_use_emojis branch from 74d11f5 to ceec410 Compare February 24, 2026 15:58
@i1skn i1skn force-pushed the 02-24-refactor_remove_emoji-datasource_from_dependcies branch from edd2a9e to b0d1975 Compare February 24, 2026 15:58
@i1skn i1skn marked this pull request as ready for review February 24, 2026 16:12
@i1skn i1skn force-pushed the 02-24-refactor_remove_emoji-datasource_from_dependcies branch from b0d1975 to c958369 Compare February 24, 2026 16:20
@i1skn i1skn requested review from maxbbb and olerass February 24, 2026 16:22
@github-actions
Copy link

🧪 Flashlight Performance Report (AWS Device Farm)

🔀 Commit: ade1831

📎 View Artifacts

Metric Current Δ vs Baseline
Time to Interactive (TTI) 5321 ms 🟢 -104.5 ms (-1.9%)
Average FPS 55.79 🔴 -1.1 (-2.0%)
Average RAM 388.7 MB 🟢 -6.3 MB (-1.6%)

@github-actions
Copy link

Launch in simulator or device for ade1831

@olerass
Copy link
Contributor

olerass commented Feb 24, 2026

Nice cleanup! Didn't fully review yet, but one thought I had was if we should not keep commiting the generated file to git? If we commit it:

  • Zero friction for new setups onboarding (just yarn install), one less step to break in yarn setup
  • CI and local builds become more predictable
  • Code review is easier, can see exactly what gets shipped and what changes on package or script updates. With the script as source it's hard to review for correctness as we don't see the output
  • It's not a large file anyway (anymore)

I know we do compile time generation of e.g networks.json, but this is a non-deterministic generation fetching data from a live api vs the emoji process which is a pure deterministic transform.

const emojiDatasource = require('emoji-datasource');
const { CATEGORY_ID_BY_CATEGORY_NAME } = require('../src/features/emoji/constants');

const OUTPUT_PATH = path.resolve(__dirname, '../src/features/emoji/models/emojis.json');
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should keep generated files out of features. Mixing generated files with actual src is confusing and makes it hard to judge what is actual source and what is not. Also gitignoring things deep inside src seems wrong (that goes away if we commit the file though which I rec, see my overall comment on the PR).

src/references is the canonical place for generated data today, keeping it there is more predictable IMO. Optimally, it should prob be named assets or similar, and the generated graphql should move there too, but that's for another time.

@olerass
Copy link
Contributor

olerass commented Feb 24, 2026

yarn generate:emojis also fail on my machine because the script uses cjs but constants.js uses ESM.

@olerass
Copy link
Contributor

olerass commented Feb 24, 2026

Sorry for the many comments, I didn't expect this to be a thorough review in my evening, but I started and coulnd't stop myself 🤣

I had Claude generate a comparison script between the current emoji data on develop and what the generation script produces. There's a pretty significant gap:

  • 937 emoji names that exist today are missing in the new catalog
  • Every avatar picker category has fewer emojis (e.g. smileys goes from 408 to 241, activities from 60 to 55)
  • 18 currency flag lookups break

I think the root cause is that on develop, the avatar picker and the name lookup (resolveEmoji) use two completely separate data sources. The avatar picker imports emoji-datasource directly and uses the full array (just filters obsoleted_by, groups by category, sorts by sort_order). The name lookup uses the curated src/references/emojis.json which is a different dataset with different naming.

289 entries in emoji-datasource have name: null. From what I can tell these are "variation-selector" versions of emojis. I don't fully understand the Unicode side of this, but afaiu some emojis exist as two entries in the dataset; a base version and a version with an invisible character (FE0F) appended that hints to the OS "render this as an emoji glyph." The FE0F variants seem to be the the ones with null name.

This didn't matter before because the old avatar picker code used the raw array and never looked at the name field. This PR funeling both through a the name-keyed catalog causes the drops: no name = no key = not in the catalog = not in the picker. The name lookup side also loses coverage because emoji-datasource uses different names than the old curated file.

For example, the 5 missing Activities emojis are all name: null in the package: 🎖️🎗️ 🎟️ 🕹️ ⛸️ as seen on below screenshots.

Develop PR
activities-develop activites-pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants