mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-10 23:23:04 -04:00
Settings: Fix resetting scroll/search when getting a ping (#1106)
This commit is contained in:
parent
0c54b1fa1d
commit
5c5b009c41
15 changed files with 110 additions and 183 deletions
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue