1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-09 09:26:22 +00:00

typingTweaks: wrap in ErrorBoundary

This commit is contained in:
Vendicated 2024-12-19 20:53:16 +01:00
parent 33bca8e3ba
commit 7f8ee65fdd
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -23,6 +23,7 @@ import { openUserProfile } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common";
import { User } from "discord-types/general";
import { PropsWithChildren } from "react";
const settings = definePluginSettings({
showAvatars: {
@ -100,7 +101,7 @@ export default definePlugin({
{
// Style the indicator and add function call to modify the children before rendering
match: /(?<=children:\[(\i)\.length>0.{0,200}?"aria-atomic":!0,children:)\i(?<=guildId:(\i).+?)/,
replace: "$self.mutateChildren($2,$1,$&),style:$self.TYPING_TEXT_STYLE"
replace: "$self.renderTypingUsers({ users: $1, guildId: $2, children: $& }),style:$self.TYPING_TEXT_STYLE"
},
{
// Changes the indicator to keep the user object when creating the list of typing users
@ -125,7 +126,7 @@ export default definePlugin({
buildSeveralUsers,
mutateChildren(guildId: any, users: User[], children: any) {
renderTypingUsers: ErrorBoundary.wrap(({ guildId, users, children }: PropsWithChildren<{ guildId: string, users: User[]; }>) => {
try {
if (!Array.isArray(children)) {
return children;
@ -145,5 +146,5 @@ export default definePlugin({
}
return children;
}
}, { noop: true })
});