mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-23 05:17:02 -04:00
Add React eslint & update depencenies (#3090)
Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
This commit is contained in:
parent
16a1c44947
commit
7be3a40b7c
56 changed files with 2025 additions and 1529 deletions
|
@ -23,7 +23,7 @@ import { Queue } from "@utils/Queue";
|
|||
import { useForceUpdater } from "@utils/react";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { ChannelStore, Constants, FluxDispatcher, React, RestAPI, Tooltip } from "@webpack/common";
|
||||
import { ChannelStore, Constants, FluxDispatcher, React, RestAPI, Tooltip, useEffect, useLayoutEffect } from "@webpack/common";
|
||||
import { CustomEmoji } from "@webpack/types";
|
||||
import { Message, ReactionEmoji, User } from "discord-types/general";
|
||||
|
||||
|
@ -134,18 +134,21 @@ export default definePlugin({
|
|||
renderUsers(props: RootObject) {
|
||||
return props.message.reactions.length > 10 ? null : (
|
||||
<ErrorBoundary noop>
|
||||
<this._renderUsers {...props} />
|
||||
<this.UsersComponent {...props} />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
},
|
||||
_renderUsers({ message, emoji, type }: RootObject) {
|
||||
|
||||
UsersComponent({ message, emoji, type }: RootObject) {
|
||||
const forceUpdate = useForceUpdater();
|
||||
React.useLayoutEffect(() => { // bc need to prevent autoscrolling
|
||||
|
||||
useLayoutEffect(() => { // bc need to prevent autoscrolling
|
||||
if (Scroll?.scrollCounter > 0) {
|
||||
Scroll.setAutomaticAnchor(null);
|
||||
}
|
||||
});
|
||||
React.useEffect(() => {
|
||||
|
||||
useEffect(() => {
|
||||
const cb = (e: any) => {
|
||||
if (e.messageId === message.id)
|
||||
forceUpdate();
|
||||
|
@ -153,7 +156,7 @@ export default definePlugin({
|
|||
FluxDispatcher.subscribe("MESSAGE_REACTION_ADD_USERS", cb);
|
||||
|
||||
return () => FluxDispatcher.unsubscribe("MESSAGE_REACTION_ADD_USERS", cb);
|
||||
}, [message.id]);
|
||||
}, [message.id, forceUpdate]);
|
||||
|
||||
const reactions = getReactionsWithQueue(message, emoji, type);
|
||||
const users = Object.values(reactions).filter(Boolean) as User[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue