aboutsummaryrefslogtreecommitdiff
path: root/src/components/PluginSettings
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-05-12 01:40:43 +0200
committerGitHub <noreply@github.com>2023-05-12 01:40:43 +0200
commit5c5b009c4180b73603a9c3a6c6663f889a2e2062 (patch)
tree9f586ff1e4491bbd8d7ac046d60bbae081d1d6f8 /src/components/PluginSettings
parent0c54b1fa1d8f9d858baf912bb4b1efd9d3c0ec93 (diff)
downloadVencord-5c5b009c4180b73603a9c3a6c6663f889a2e2062.tar.gz
Vencord-5c5b009c4180b73603a9c3a6c6663f889a2e2062.tar.bz2
Vencord-5c5b009c4180b73603a9c3a6c6663f889a2e2062.zip
Settings: Fix resetting scroll/search when getting a ping (#1106)
Diffstat (limited to 'src/components/PluginSettings')
-rw-r--r--src/components/PluginSettings/index.tsx19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx
index 3fb9bb4..8ccc740 100644
--- a/src/components/PluginSettings/index.tsx
+++ b/src/components/PluginSettings/index.tsx
@@ -20,20 +20,18 @@ import "./styles.css";
import * as DataStore from "@api/DataStore";
import { showNotice } from "@api/Notices";
-import { useSettings } from "@api/Settings";
+import { Settings, useSettings } from "@api/Settings";
import { classNameFactory } from "@api/Styles";
-import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
-import { handleComponentFailed } from "@components/handleComponentFailed";
import { Badge } from "@components/PluginSettings/components";
import PluginModal from "@components/PluginSettings/PluginModal";
import { Switch } from "@components/Switch";
+import { SettingsTab } from "@components/VencordSettings/shared";
import { ChangeList } from "@utils/ChangeList";
import { Logger } from "@utils/Logger";
import { Margins } from "@utils/margins";
import { classes } from "@utils/misc";
import { openModalLazy } from "@utils/modal";
-import { onlyOnce } from "@utils/onlyOnce";
import { LazyComponent, useAwaiter } from "@utils/react";
import { Plugin } from "@utils/types";
import { findByCode, findByPropsLazy } from "@webpack";
@@ -96,7 +94,7 @@ interface PluginCardProps extends React.HTMLProps<HTMLDivElement> {
}
function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) {
- const settings = useSettings([`plugins.${plugin.name}.enabled`]).plugins[plugin.name];
+ const settings = Settings.plugins[plugin.name];
const isEnabled = () => settings.enabled ?? false;
@@ -179,7 +177,7 @@ enum SearchStatus {
DISABLED
}
-export default ErrorBoundary.wrap(function PluginSettings() {
+export default function PluginSettings() {
const settings = useSettings();
const changes = React.useMemo(() => new ChangeList<string>(), []);
@@ -303,7 +301,7 @@ export default ErrorBoundary.wrap(function PluginSettings() {
}
return (
- <Forms.FormSection className={Margins.top16}>
+ <SettingsTab title="Plugins">
<ReloadRequiredCard required={changes.hasChanges} />
<Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}>
@@ -342,12 +340,9 @@ export default ErrorBoundary.wrap(function PluginSettings() {
<div className={cl("grid")}>
{requiredPlugins}
</div>
- </Forms.FormSection >
+ </SettingsTab >
);
-}, {
- message: "Failed to render the Plugin Settings. If this persists, try using the installer to reinstall!",
- onError: onlyOnce(handleComponentFailed),
-});
+}
function makeDependencyList(deps: string[]) {
return (