Skip to content

Conversation

@wayou
Copy link
Owner

@wayou wayou commented May 21, 2025

Previously, the _showEmoji function determined the total number of emojis by inspecting the DOM (emojiWrapper.children.length). This could lead to a race condition if an incoming message containing an emoji was processed before the _initialEmoji function had fully populated the emojiWrapper. In such cases, totalEmojiNum would be 0 (or an incorrect intermediate value), causing valid emojis to be displayed as '[X]'.

This commit fixes the issue by setting totalEmojiNum to a constant value of 69, which is the actual number of emojis (1.gif to 69.gif) supported by the application. This makes the emoji display logic robust and independent of the DOM state of the emoji panel during message processing.

This likely addresses the underlying problem referred to as 'issue #19', where specific emojis might have been reported as not working due to this timing-sensitive bug.

Previously, the `_showEmoji` function determined the total number of
emojis by inspecting the DOM (`emojiWrapper.children.length`).
This could lead to a race condition if an incoming message containing
an emoji was processed before the `_initialEmoji` function had fully
populated the emojiWrapper. In such cases, `totalEmojiNum` would be
0 (or an incorrect intermediate value), causing valid emojis to be
displayed as '[X]'.

This commit fixes the issue by setting `totalEmojiNum` to a constant
value of 69, which is the actual number of emojis (1.gif to 69.gif)
supported by the application. This makes the emoji display logic
robust and independent of the DOM state of the emoji panel during
message processing.

This likely addresses the underlying problem referred to as 'issue #19',
where specific emojis might have been reported as not working due to this
timing-sensitive bug.
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