mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 01:46:23 +00:00
typingTweaks: wrap in ErrorBoundary
This commit is contained in:
parent
33bca8e3ba
commit
7f8ee65fdd
1 changed files with 4 additions and 3 deletions
|
@ -23,6 +23,7 @@ import { openUserProfile } from "@utils/discord";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common";
|
import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
import { PropsWithChildren } from "react";
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
showAvatars: {
|
showAvatars: {
|
||||||
|
@ -100,7 +101,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
// Style the indicator and add function call to modify the children before rendering
|
// 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).+?)/,
|
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
|
// Changes the indicator to keep the user object when creating the list of typing users
|
||||||
|
@ -125,7 +126,7 @@ export default definePlugin({
|
||||||
|
|
||||||
buildSeveralUsers,
|
buildSeveralUsers,
|
||||||
|
|
||||||
mutateChildren(guildId: any, users: User[], children: any) {
|
renderTypingUsers: ErrorBoundary.wrap(({ guildId, users, children }: PropsWithChildren<{ guildId: string, users: User[]; }>) => {
|
||||||
try {
|
try {
|
||||||
if (!Array.isArray(children)) {
|
if (!Array.isArray(children)) {
|
||||||
return children;
|
return children;
|
||||||
|
@ -145,5 +146,5 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
|
|
||||||
return children;
|
return children;
|
||||||
}
|
}, { noop: true })
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue