Skip to content

Fix custom emoji reactions rendering as literal name:id text#104

Merged
krazyjakee merged 1 commit into
masterfrom
fix/custom-emoji-reaction-token
Jun 10, 2026
Merged

Fix custom emoji reactions rendering as literal name:id text#104
krazyjakee merged 1 commit into
masterfrom
fix/custom-emoji-reaction-token

Conversation

@krazyjakee

Copy link
Copy Markdown
Contributor

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 emoji name with a null id, so the pill took the unicode-glyph branch and printed the token verbatim. It also never matched the optimistic local pill (name cube2), so one reaction showed as two pills.

Changes

  • emoji_catalog.dart — add parseEmojiToken() / EmojiRef, which splits the name:id custom 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 correct name + 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 through fromJson).

Test plan

  • flutter analyze --no-fatal-infos — clean
  • flutter test — 129 passing
  • Manual: add a custom-emoji reaction on a live server → single pill, image renders (couldn't verify without a running server + the custom emoji)

🤖 Generated with Claude Code

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>
@krazyjakee krazyjakee merged commit 3c97dbb into master Jun 10, 2026
5 checks passed
@krazyjakee krazyjakee deleted the fix/custom-emoji-reaction-token branch June 28, 2026 23:01
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.

1 participant