mirror of
https://github.com/Sqaaakoi/vc-newPluginsManager.git
synced 2025-02-23 00:28:52 -05:00
Prevent crashes when opening the modal
This commit is contained in:
parent
fb6e9c9bef
commit
9e425d2fd1
1 changed files with 4 additions and 3 deletions
|
@ -11,7 +11,7 @@ import { classNameFactory } from "@api/Styles";
|
||||||
import { PluginCard } from "@components/PluginSettings";
|
import { PluginCard } from "@components/PluginSettings";
|
||||||
import { ChangeList } from "@utils/ChangeList";
|
import { ChangeList } from "@utils/ChangeList";
|
||||||
import { classes, Margins } from "@utils/index";
|
import { classes, Margins } from "@utils/index";
|
||||||
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||||
import { useForceUpdater } from "@utils/react";
|
import { useForceUpdater } from "@utils/react";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { Button, Flex, Forms, React, Text, Tooltip, useMemo } from "@webpack/common";
|
import { Button, Flex, Forms, React, Text, Tooltip, useMemo } from "@webpack/common";
|
||||||
|
@ -20,6 +20,7 @@ import { JSX } from "react";
|
||||||
import Plugins from "~plugins";
|
import Plugins from "~plugins";
|
||||||
|
|
||||||
import { getNewPlugins, getNewSettings, KnownPluginSettingsMap, writeKnownSettings } from "./knownSettings";
|
import { getNewPlugins, getNewSettings, KnownPluginSettingsMap, writeKnownSettings } from "./knownSettings";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
|
||||||
const cl = classNameFactory("vc-plugins-");
|
const cl = classNameFactory("vc-plugins-");
|
||||||
|
|
||||||
|
@ -193,12 +194,12 @@ export async function openNewPluginsModal() {
|
||||||
const newSettings = await getNewSettings();
|
const newSettings = await getNewSettings();
|
||||||
if ((newPlugins.size || newSettings.size) && !hasSeen) {
|
if ((newPlugins.size || newSettings.size) && !hasSeen) {
|
||||||
hasSeen = true;
|
hasSeen = true;
|
||||||
openModal(modalProps => (
|
const modalKey = openModal(modalProps => <ErrorBoundary noop onError={() => { closeModal(modalKey); }}>
|
||||||
<NewPluginsModal
|
<NewPluginsModal
|
||||||
modalProps={modalProps}
|
modalProps={modalProps}
|
||||||
newPlugins={newPlugins}
|
newPlugins={newPlugins}
|
||||||
newSettings={newSettings}
|
newSettings={newSettings}
|
||||||
/>
|
/>
|
||||||
));
|
</ErrorBoundary>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue