Skip to content

Chat-:thumbsup: doesn't replaced with emoji. #87453

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: V9.3.55-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #87253
Email or phone of affected tester (no customers): dreamnitethedragon+vegst@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Redmi note 10s android 13
App Component: Chat Report View

Action Performed:

  1. Launch app
  2. Open a chat
  3. Enter 👍
  4. Send the message

Expected Result:

👍 must be replaced with an emoji.

Actual Result:

👍 doesn't replaced with an emoji.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    on Apr 9, 2026
  2. added
    Bug
    on Apr 9, 2026
  3. melvin-bot commented on Apr 9, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #87253

  4. melvin-bot commented on Apr 9, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Apr 9, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. OSBotify commented on Apr 9, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #87253 - "Deferring Trie Build" by @elirangoshen (High confidence)
    Related Issues: #86759

    Recommendation: REVERT

    PR #87253 introduced a regression in the lazy emoji trie loading logic that causes emoji shortcodes to never be replaced with actual emojis. Reverting this PR restores the eager trie-build behavior from LocaleContextProvider and unblocks the deploy.

    Assigned: @elirangoshen (PR author), @Julesssss (approving reviewer), @roryabraham (approving reviewer)
    Labels: DeployBlockerCash kept (Frontend bug in App repo). No label changes made.

    Detailed Analysis

    Evidence

    • PR Deferring Trie Build #87253 is explicitly linked in the issue by the melvin-bot as the causing PR.
    • The PR defers emoji trie construction from app startup (eager, in LocaleContextProvider) to first use (lazy, via getEmojiTrie() in EmojiUtils).
    • The bug reproduces on staging only (the issue states "N/A - new feature, does not exist in prod"), confirming this is a staging-only regression introduced by this PR.

    Verification

    • Affected files: src/libs/EmojiTrie.ts, src/libs/EmojiUtils.tsx, src/components/LocaleContextProvider.tsx
    • PR Deferring Trie Build #87253 directly modifies all three of these files.

    Root Cause

    localeEmojis in assets/emojis/index.ts is initialized as {en: undefined, es: undefined}. The new buildEmojisTrie logic checks if (!localeEmojis[locale]) -- since the locale data starts as undefined, this condition is always true on the first call. The function then kicks off importEmojiLocale(locale) (an async dynamic import), and immediately returns without building the trie. There is no .then(() => buildEmojisTrie(locale)) chained to that promise, so once the locale data finishes loading, the trie is never actually constructed. As a result, getEmojiTrie() returns undefined on every call until the locale data has been loaded AND buildEmojisTrie is called a second time, which never happens automatically. The replaceEmojis function in EmojiUtils.tsx exits early when the trie is undefined, leaving the shortcode text unreplaced.

  7. MelvinBot commented on Apr 9, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    PR #87253 deferred the emoji trie build from app startup to first use. The problem is in src/libs/EmojiTrie.ts:116-131: when getEmojiTrie is called for the first time, localeEmojis[locale] is still undefined (the locale data hasn't been dynamically imported yet). buildEmojisTrie fires importEmojiLocale(locale) asynchronously but returns immediately without building the trie. The .then() callback only ends a telemetry span — it never calls buildEmojisTrie again after the import completes.

    As a result, getEmojiTrie returns undefined, and replaceEmojis at src/libs/EmojiUtils.tsx:397-400 bails out, returning the original text with :thumbsup: unmodified.

    What changes do you think we should make in order to solve the problem?

    In buildEmojisTrie (src/libs/EmojiTrie.ts:127-129), the .then() callback after importEmojiLocale should actually build the trie once the import resolves:

    importEmojiLocale(locale).then(() => {
        endSpan(CONST.TELEMETRY.SPAN_LOCALE.EMOJI_IMPORT);
        buildEmojisTrie(locale); // Actually build the trie now that locale data is loaded
    });

    However, this alone doesn't fix the first call to replaceEmojis — the trie won't exist yet during that synchronous call. To fully fix this, the import should also be triggered earlier so the locale data is ready before the user types. This could be done by calling importEmojiLocale in LocaleContextProvider on locale change (as it was before the PR), while still deferring the expensive trie construction to first use.

    What alternative solutions did you explore? (Optional)

    1. Revert PR Deferring Trie Build #87253 entirely — simplest fix but loses the startup performance improvement.
    2. Make replaceEmojis async — would require changes to all callers and the message sending pipeline, which is too invasive.
    3. Pre-warm the import in LocaleContextProvider without building the trie — best of both worlds: the dynamic import starts eagerly (so data is ready), but the trie build stays lazy. This is the recommended approach.
    Investigation details

    Data flow of the bug:

    1. App starts → localeEmojis['en'] is undefined (emoji locale data not yet dynamically imported)
    2. Previously, LocaleContextProvider eagerly called buildEmojisTrie, which imported locale data and built the trie before user interaction
    3. PR Deferring Trie Build #87253 removed the eager build — trie is now only built lazily via getEmojiTrie()
    4. User types :thumbsup: → replaceEmojis → getEmojiTrie('en') → buildEmojisTrie('en')
    5. buildEmojisTrie sees localeEmojis['en'] is undefined, fires async importEmojiLocale('en'), returns immediately
    6. getEmojiTrie returns undefined → replaceEmojis returns original text unchanged
    7. The import eventually resolves in the background, but nothing re-triggers replaceEmojis
    8. On the second message attempt, the locale data is loaded, the trie gets built, and emoji replacement works

    Key code locations:

    • src/libs/EmojiTrie.ts:122-131 — early return without building trie when locale data not loaded
    • src/libs/EmojiTrie.ts:143-146 — getEmojiTrie returns undefined on first call
    • src/libs/EmojiUtils.tsx:397-400 — replaceEmojis bails out when trie is undefined
    • assets/emojis/index.ts — localeEmojis initialized with all values as undefined

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  8. elirangoshen commented on Apr 9, 2026

    @elirangoshen
    Contributor

    Ok Im working on it and would update asap

  9. elirangoshen commented on Apr 9, 2026

    @elirangoshen
    Contributor

    I suspect that its not regression:

    The emoji's name is +1, not :thumbsup:. :thumbsup: is only a keyword (for search/suggestions).

    also in prod 👍 is not giving any emoji so i think that the qa test is might be wrong

    more technical info :

    The emoji names in common.ts follow the GitHub emoji shortcode convention (from gemoji), where thumbs up is :+1: not  :thumbsup:. GitHub actually supports both — :+1: and :thumbsup: are aliases for the same      
    emoji. 
    

    Our codebase only has one name per emoji (the primary), and thumbsup is only a keyword for search. GitHub for example maintains an alias list where multiple shortcodes map to the same emoji. - which explain why the review might thinks we missing this - but its not issue seems it was like this before. if you want I can open pr to add this one to our list so it will be supported ?

    Image
  10. added
    Weekly
    and removed
    DeployBlockerCash
    Hourly
    on Apr 9, 2026
  11. Julesssss commented on Apr 9, 2026

    @Julesssss
    Contributor

    Yes I think this might be a missunderstanding of the test case here. +1 is being replaced correctly

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

Metadata

Metadata

Labels

BugEngineeringWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions