regression: missing emojis in picker search#41342
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📜 Recent review details⏰ Context from checks skipped due to timeout. (5)
|
| Layer / File(s) | Summary |
|---|---|
Emoji data name contract apps/meteor/app/emoji-native/lib/generateEmojiData.ts, apps/meteor/app/emoji/lib/rocketchat.ts |
Native emoji entries now include generated names, and package list types distinguish entries with and without names. |
Search matching and deduplication apps/meteor/app/emoji/client/helpers.ts |
getEmojisBySearchTerm deduplicates results, matches using category and shortcode data, and skips unavailable rendered emojis. |
Native emoji search tests apps/meteor/tests/unit/app/emoji/helpers.spec.ts |
Registers native emoji metadata and tests shortcode, alias, partial-match, duplicate, and skin-tone filtering behavior. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Possibly related PRs
- RocketChat/Rocket.Chat#39411: Updates related native emoji codepaths and emoji data generation.
Suggested labels: type: bug
Suggested reviewers: sampaiodiego, cardoso
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly summarizes the main regression fix: missing emojis in picker search. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
Warning
Review ran into problems
🔥 Problems
Errors were encountered while retrieving linked issues.
Errors (1)
- CORE-2415: Request failed with status code 401
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #41342 +/- ##
===========================================
- Coverage 69.11% 68.22% -0.90%
===========================================
Files 3759 3968 +209
Lines 147859 154749 +6890
Branches 26420 27802 +1382
===========================================
+ Hits 102196 105573 +3377
- Misses 41179 44383 +3204
- Partials 4484 4793 +309
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
apps/meteor/tests/unit/app/emoji/helpers.spec.ts (1)
37-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNo teardown for
registerNativeEmojis— mutates shared singleton for the rest of the suite.
before(registerNativeEmojis)populatesemoji.packages.nativeand adds many entries toemoji.liston the sharedemojisingleton (imported fromapps/meteor/app/emoji/client/lib.ts), but there's noafterhook to remove them. Any other test blocks in this file or process sharing this module instance (e.g. tests forupdateRecent/removeFromRecent/replaceEmojiInRecent) that run after this describe block could observe polluted state.🧹 Suggested cleanup
describe('getEmojisBySearchTerm', () => { before(registerNativeEmojis); + after(() => { + delete emoji.packages.native; + // also remove entries added to emoji.list by registerNativeEmojis + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/meteor/tests/unit/app/emoji/helpers.spec.ts` around lines 37 - 39, Add teardown to the getEmojisBySearchTerm suite that reverses the shared emoji singleton mutations performed by registerNativeEmojis, including clearing emoji.packages.native and removing its entries from emoji.list. Use the existing emoji state and cleanup utilities if available, and ensure subsequent tests start with the same state as before setup.apps/meteor/app/emoji/client/helpers.ts (1)
189-194: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCategory-membership scan runs per matching candidate.
Object.values(...emojisByCategory).some(contents => contents.indexOf(categoryName) !== -1)linearly scans every category array for every key that passes the initial regex test. For short search terms that match many keys (e.g. a single character while typing), this becomes an O(candidates × categories × itemsPerCategory) scan on a UI hot path. Consider building aSet<string>of category members once per package (memoized outside the loop or cached alongside the package) and doing an O(1).has()lookup instead.♻️ Possible optimization
+ const categoryMembership = new Map<string, Set<string>>(); + for (let current in emoji.list) { ... - const isCategoryEmoji = Object.values(emoji.packages[emojiPackage].emojisByCategory).some( - (contents) => contents.indexOf(categoryName) !== -1, - ); + if (!categoryMembership.has(emojiPackage)) { + categoryMembership.set( + emojiPackage, + new Set(Object.values(emoji.packages[emojiPackage].emojisByCategory).flat()), + ); + } + const isCategoryEmoji = categoryMembership.get(emojiPackage)!.has(categoryName);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/meteor/app/emoji/client/helpers.ts` around lines 189 - 194, In the candidate-filtering loop around isCategoryEmoji, avoid rescanning every emojisByCategory array for each matching key. Build or reuse a per-package Set containing the category members before the loop, then replace the per-candidate Object.values(...).some(...) scan with an O(1) membership lookup while preserving the existing !isCategoryEmoji && shortnames.length === 0 filtering behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/meteor/app/emoji/client/helpers.ts`:
- Around line 171-173: Update the deduplication logic in the emoji-processing
flow to check and record the resolved actualEmoji value rather than emojiObject.
Move the seenEmojis check/add so entries resolving to the same actualEmoji are
emitted only once, while preserving the existing row-generation behavior.
---
Nitpick comments:
In `@apps/meteor/app/emoji/client/helpers.ts`:
- Around line 189-194: In the candidate-filtering loop around isCategoryEmoji,
avoid rescanning every emojisByCategory array for each matching key. Build or
reuse a per-package Set containing the category members before the loop, then
replace the per-candidate Object.values(...).some(...) scan with an O(1)
membership lookup while preserving the existing !isCategoryEmoji &&
shortnames.length === 0 filtering behavior.
In `@apps/meteor/tests/unit/app/emoji/helpers.spec.ts`:
- Around line 37-39: Add teardown to the getEmojisBySearchTerm suite that
reverses the shared emoji singleton mutations performed by registerNativeEmojis,
including clearing emoji.packages.native and removing its entries from
emoji.list. Use the existing emoji state and cleanup utilities if available, and
ensure subsequent tests start with the same state as before setup.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a92cf746-ec38-460c-9577-df15aef68893
📒 Files selected for processing (2)
apps/meteor/app/emoji/client/helpers.tsapps/meteor/tests/unit/app/emoji/helpers.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/tests/unit/app/emoji/helpers.spec.tsapps/meteor/app/emoji/client/helpers.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/tests/unit/app/emoji/helpers.spec.ts
🧠 Learnings (5)
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
apps/meteor/tests/unit/app/emoji/helpers.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/tests/unit/app/emoji/helpers.spec.tsapps/meteor/app/emoji/client/helpers.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/tests/unit/app/emoji/helpers.spec.tsapps/meteor/app/emoji/client/helpers.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
apps/meteor/tests/unit/app/emoji/helpers.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/tests/unit/app/emoji/helpers.spec.tsapps/meteor/app/emoji/client/helpers.ts
🪛 ast-grep (0.44.1)
apps/meteor/app/emoji/client/helpers.ts
[warning] 160-160: Do not use variable for regular expressions
Context: new RegExp(escapeRegExp(searchTerm.replace(/:/g, '')), 'i')
Note: [CWE-1333] Inefficient Regular Expression Complexity. Security best practice.
(regexp-non-literal-typescript)
🔇 Additional comments (3)
apps/meteor/app/emoji/client/helpers.ts (1)
195-208: LGTM on thebreak→continuefix.Skipping (instead of aborting the whole search) when the rendered emoji for a candidate can't be resolved directly addresses the "missing emojis in picker search" regression — a single unrenderable candidate no longer terminates the entire scan.
apps/meteor/tests/unit/app/emoji/helpers.spec.ts (2)
40-68: LGTM!
11-22: 🎯 Functional CorrectnessNo typing issue here
EmojiPackages['native']is assignable toEmojiPackage, andcategoryIndexis optional.getEmojiConfig()already returnsemojiListentries withemojiPackage, so the direct mutation andemoji.packages.nativeassignment match the existing types.> Likely an incorrect or invalid review comment.
| if (seenEmojis.has(emojiObject)) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="apps/meteor/app/emoji/client/helpers.ts"
# Map the file structure first, then inspect the relevant section.
ast-grep outline "$file" --view expanded || true
wc -l "$file"
sed -n '140,235p' "$file"Repository: RocketChat/Rocket.Chat
Length of output: 4526
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find where emoji.list is defined/populated and inspect the relevant parts.
rg -n "emoji\.list|packages\.base|renderPicker|emojisByCategory|toneList" apps/meteor/app/emoji -g '*.ts' -g '*.js' -g '*.tsx' || true
# Inspect the helper around the dedupe logic and nearby calls.
sed -n '153,235p' apps/meteor/app/emoji/client/helpers.ts
# Inspect the emoji data source if present in the repo.
fd -a "emoji" apps/meteor/app | sed -n '1,40p'Repository: RocketChat/Rocket.Chat
Length of output: 7018
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect emoji list construction and package loading for object identity / aliasing.
sed -n '1,220p' apps/meteor/app/emoji/client/lib.ts
printf '\n---\n'
sed -n '1,220p' apps/meteor/app/emoji/server/lib.ts
printf '\n---\n'
sed -n '1,260p' apps/meteor/app/emoji/lib/rocketchat.ts
printf '\n---\n'
rg -n "emoji\.list\s*=|list\[[^]]+\]|alias|shortnames|emojiPackage" apps/meteor/app/emoji -g '*.ts' -g '*.js'Repository: RocketChat/Rocket.Chat
Length of output: 6246
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the category picker path that uses the same emoji lookup pattern.
sed -n '60,120p' apps/meteor/app/emoji/client/helpers.ts
# Show the search helper with line numbers for exact control flow.
cat -n apps/meteor/app/emoji/client/helpers.ts | sed -n '153,210p'
# Look for alias handling in emoji data generation / loading.
rg -n "aliasOf|aliases|shortnames|emojiToRender|seenEmojis" apps/meteor/app/emoji-native apps/meteor/app/emoji-custom apps/meteor/app/emoji/client -g '*.ts' -g '*.js'Repository: RocketChat/Rocket.Chat
Length of output: 9332
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the emoji data generation/loading path where list entries and aliases are created.
cat -n apps/meteor/app/emoji-native/lib/generateEmojiData.ts | sed -n '1,220p'
printf '\n---\n'
cat -n apps/meteor/app/emoji-native/server/lib.ts | sed -n '1,220p'
printf '\n---\n'
cat -n apps/meteor/app/emoji-custom/server/lib/insertOrUpdateEmoji.ts | sed -n '1,240p'Repository: RocketChat/Rocket.Chat
Length of output: 12901
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect custom emoji registration to see whether multiple keys can share or replace objects.
rg -n "emoji\.list\[|emojiCustom|aliases|renderPicker" apps/meteor/app/emoji-custom apps/meteor/app/emoji -g '*.ts' -g '*.js'Repository: RocketChat/Rocket.Chat
Length of output: 4568
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect custom emoji client/server registration code to see how aliases map into emoji.list.
rg -n "setAliases|updateCustom|emoji.list\\[.*alias|emojiCustom" apps/meteor/app -g '*.ts' -g '*.js'Repository: RocketChat/Rocket.Chat
Length of output: 2012
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the native emoji config path that handles custom overrides.
cat -n apps/meteor/app/emoji-native/lib/getEmojiConfig.ts | sed -n '1,220p'
printf '\n---\n'
# Find direct emoji.list assignments across the emoji codepaths.
rg -n "emoji\.list\s*\[.*\]\s*=" apps/meteor/app/emoji apps/meteor/app/emoji-native apps/meteor/app/emoji-custom -g '*.ts' -g '*.js'
printf '\n---\n'
# Inspect any custom emoji package registration/loading path if present.
fd -a "emoji-custom" apps/meteor/app | sed -n '1,80p'Repository: RocketChat/Rocket.Chat
Length of output: 4952
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the custom emoji startup/registration path to see how its entries enter emoji.list.
sed -n '1,220p' apps/meteor/app/emoji-custom/server/startup/emoji-custom.js
printf '\n---\n'
rg -n "emoji\.list|EmojiCustom|emoji.updateCustom|aliases" apps/meteor/app/emoji-custom/server -g '*.ts' -g '*.js'Repository: RocketChat/Rocket.Chat
Length of output: 14383
Deduplicate on the resolved emoji object. emojiObject can differ while actualEmoji is the same (for example, base and tone-specific keys resolving to one render target), so duplicate rows still slip through. Move the seenEmojis check/add to actualEmoji.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/meteor/app/emoji/client/helpers.ts` around lines 171 - 173, Update the
deduplication logic in the emoji-processing flow to check and record the
resolved actualEmoji value rather than emojiObject. Move the seenEmojis
check/add so entries resolving to the same actualEmoji are emitted only once,
while preserving the existing row-generation behavior.
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
can you add a test to the scenario mentioned by Cubic?
something like:
it('applies the selected skin tone when searching by an alias', () => {
const result = getEmojisBySearchTerm('thumbsup', 2, [], () => undefined).find(({ image }) =>
image?.includes('👍'));
expect(result).to.exist;
expect(result?.image).to.include('👍🏼');
});
Proposed changes (including videos or screenshots)
Issue(s)
CORE-2415
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Bug Fixes
Tests