Skip to content

Commit

Permalink
Merge pull request #595 from vyneer/fix/emote-username
Browse files Browse the repository at this point in the history
fix: emotes getting removed from autocomplete sometimes
  • Loading branch information
11k authored Dec 23, 2024
2 parents 7c82683 + 55fba62 commit b950bc1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions assets/chat/js/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,20 @@ class ChatAutoComplete {
const id = getBucketId(str);
const bucket =
this.buckets.get(id) || this.buckets.set(id, new Map()).get(id);
const data = Object.assign(bucket.get(str) || {}, {

const existingData = bucket.get(str);
if (existingData && existingData.isemote) {
return existingData;
}

const newData = Object.assign(bucket.get(str) || {}, {
data: str,
weight,
isemote,
});
bucket.set(str, data);
return data;
bucket.set(str, newData);

return newData;
}

remove(str, userOnly = false) {
Expand Down

0 comments on commit b950bc1

Please sign in to comment.