mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 05:42:55 -04:00
WhoReacted: fix crashing (app reloading)
This commit is contained in:
parent
2a4314efc9
commit
eafbc0d15a
1 changed files with 3 additions and 3 deletions
|
@ -66,7 +66,7 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) {
|
|||
|
||||
function getReactionsWithQueue(msg: Message, e: ReactionEmoji, type: number) {
|
||||
const key = `${msg.id}:${e.name}:${e.id ?? ""}:${type}`;
|
||||
const cache = reactions[key] ??= { fetched: false, users: {} };
|
||||
const cache = reactions[key] ??= { fetched: false, users: new Map() };
|
||||
if (!cache.fetched) {
|
||||
queue.unshift(() => fetchReactions(msg, e, type));
|
||||
cache.fetched = true;
|
||||
|
@ -159,7 +159,7 @@ export default definePlugin({
|
|||
}, [message.id, forceUpdate]);
|
||||
|
||||
const reactions = getReactionsWithQueue(message, emoji, type);
|
||||
const users = Object.values(reactions).filter(Boolean) as User[];
|
||||
const users = [...reactions.values()].filter(Boolean);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
@ -187,7 +187,7 @@ export default definePlugin({
|
|||
|
||||
interface ReactionCacheEntry {
|
||||
fetched: boolean;
|
||||
users: Record<string, User>;
|
||||
users: Map<string, User>;
|
||||
}
|
||||
|
||||
interface RootObject {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue