Fix custom emoji reactions rendering as literal name:id text#104
Merged
Conversation
Custom emoji reactions arrive from the gateway as the bare token `name:id` (id a numeric snowflake). The reaction handler treated the whole string as the emoji name with a null id, so the pill took the unicode branch and printed `cube2:323038910819074048` as text. It also failed to match the optimistic local pill (name `cube2`), leaving two pills for one reaction. Add `parseEmojiToken()` to split the custom form, parse it at the gateway boundary, and harden the dedup key and renderer to recover an id baked into the name so REST-loaded reactions render correctly too. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adding a reaction with a custom emoji rendered the chip as raw text — e.g.
cube2:323038910819074048— and produced a second pill alongside the correct one.Custom emoji travel from the Accord gateway as the bare token
name:id(id a numeric snowflake). The reaction handler stored the whole string as the emojinamewith anullid, so the pill took the unicode-glyph branch and printed the token verbatim. It also never matched the optimistic local pill (namecube2), so one reaction showed as two pills.Changes
emoji_catalog.dart— addparseEmojiToken()/EmojiRef, which splits thename:idcustom form (trailing all-digit segment) and leaves unicode glyphs/shortcodes untouched.accord_event_handler.dart— parse the gateway reaction token so the live reaction is stored with the correctname+id. This is the primary fix: the image renders and the pill merges with the optimistic one.accord_messages.dart/accord_home_message_row.dart— harden the dedup key and the renderer to recover an id baked into the name, so reactions loaded via REST (message history) render correctly as well.Companion fix at the SDK source (
AccordReaction.fromJson) is in DaccordProject/accordkit-dart — the two are complementary: the SDK fix covers REST-loaded reactions, this repo's handler fix covers live gateway echoes (raw JSON that never passes throughfromJson).Test plan
flutter analyze --no-fatal-infos— cleanflutter test— 129 passing🤖 Generated with Claude Code