mirror of
https://github.com/System-End/Vencord.git
synced 2026-04-19 16:28:16 +00:00
plugin settings: fix not removing dummy user after load
This commit is contained in:
parent
1515319b96
commit
dc27c4da76
1 changed files with 5 additions and 4 deletions
|
|
@ -32,7 +32,7 @@ import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, Mod
|
|||
import { OptionType, Plugin } from "@utils/types";
|
||||
import { User } from "@vencord/discord-types";
|
||||
import { findCssClassesLazy } from "@webpack";
|
||||
import { Clickable, FluxDispatcher, Forms, React, Text, Tooltip, useEffect, UserStore, UserSummaryItem, UserUtils, useState } from "@webpack/common";
|
||||
import { Clickable, FluxDispatcher, Forms, React, Text, Tooltip, useEffect, useMemo, UserStore, UserSummaryItem, UserUtils, useState } from "@webpack/common";
|
||||
import { Constructor } from "type-fest";
|
||||
|
||||
import { PluginMeta } from "~plugins";
|
||||
|
|
@ -72,8 +72,9 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
|
|||
const pluginSettings = useSettings([`plugins.${plugin.name}.*`]).plugins[plugin.name];
|
||||
const hasSettings = Boolean(pluginSettings && plugin.options && !isObjectEmpty(plugin.options));
|
||||
|
||||
// prefill dummy user to avoid layout shift
|
||||
const [authors, setAuthors] = useState<Partial<User>[]>(() => [makeDummyUser({ username: "Loading...", id: "-1465912127305809920" })]);
|
||||
// avoid layout shift by showing dummy users while loading users
|
||||
const fallbackAuthors = useMemo(() => [makeDummyUser({ username: "Loading...", id: "-1465912127305809920" })], []);
|
||||
const [authors, setAuthors] = useState<Partial<User>[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
|
|
@ -179,7 +180,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
|
|||
<div style={{ width: "fit-content" }}>
|
||||
<ErrorBoundary noop>
|
||||
<UserSummaryItem
|
||||
users={authors}
|
||||
users={authors.length ? authors : fallbackAuthors}
|
||||
guildId={undefined}
|
||||
renderIcon={false}
|
||||
max={6}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue