mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-13 08:33:01 -04:00
Fix Vencord Notifications & ImageZoom causing crashes
This commit is contained in:
parent
700b971e7d
commit
dad69e0d0f
2 changed files with 11 additions and 6 deletions
|
@ -21,6 +21,7 @@ import { definePluginSettings } from "@api/Settings";
|
||||||
import { makeRange } from "@components/PluginSettings/components";
|
import { makeRange } from "@components/PluginSettings/components";
|
||||||
import { debounce } from "@shared/debounce";
|
import { debounce } from "@shared/debounce";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { Menu, ReactDOM } from "@webpack/common";
|
import { Menu, ReactDOM } from "@webpack/common";
|
||||||
import { JSX } from "react";
|
import { JSX } from "react";
|
||||||
|
@ -237,12 +238,16 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
renderMagnifier(instance) {
|
renderMagnifier(instance) {
|
||||||
if (instance.props.id === ELEMENT_ID) {
|
try {
|
||||||
if (!this.currentMagnifierElement) {
|
if (instance.props.id === ELEMENT_ID) {
|
||||||
this.currentMagnifierElement = <Magnifier size={settings.store.size} zoom={settings.store.zoom} instance={instance} />;
|
if (!this.currentMagnifierElement) {
|
||||||
this.root = ReactDOM.createRoot(this.element!);
|
this.currentMagnifierElement = <Magnifier size={settings.store.size} zoom={settings.store.zoom} instance={instance} />;
|
||||||
this.root.render(this.currentMagnifierElement);
|
this.root = ReactDOM.createRoot(this.element!);
|
||||||
|
this.root.render(this.currentMagnifierElement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
new Logger("ImageZoom").error("Failed to render magnifier:", error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export let useRef: typeof React.useRef;
|
||||||
export let useReducer: typeof React.useReducer;
|
export let useReducer: typeof React.useReducer;
|
||||||
export let useCallback: typeof React.useCallback;
|
export let useCallback: typeof React.useCallback;
|
||||||
|
|
||||||
export const ReactDOM: typeof import("react-dom") & typeof import("react-dom/client") = findByPropsLazy("createPortal", "render");
|
export const ReactDOM: typeof import("react-dom") & typeof import("react-dom/client") = findByPropsLazy("createPortal");
|
||||||
|
|
||||||
waitFor("useState", m => {
|
waitFor("useState", m => {
|
||||||
React = m;
|
React = m;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue