apply css only only if plugin enabled

This commit is contained in:
vishnyanetchereshnya 2024-07-12 08:00:52 +03:00 committed by GitHub
parent fc3f7761fd
commit b0daabdf71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import "./styles.css"; import { disableStyle, enableStyle } from "@api/Styles";
import styles from "./styles.css?managed";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
@ -83,10 +84,14 @@ export default definePlugin({
start: async () => { start: async () => {
FluxDispatcher.subscribe("USER_NOTE_UPDATE", onNoteUpdate); FluxDispatcher.subscribe("USER_NOTE_UPDATE", onNoteUpdate);
FluxDispatcher.subscribe("USER_UPDATE", onUserUpdate); FluxDispatcher.subscribe("USER_UPDATE", onUserUpdate);
enableStyle(styles);
}, },
stop: () => { stop: () => {
FluxDispatcher.unsubscribe("USER_NOTE_UPDATE", onNoteUpdate); FluxDispatcher.unsubscribe("USER_NOTE_UPDATE", onNoteUpdate);
FluxDispatcher.unsubscribe("USER_UPDATE", onUserUpdate); FluxDispatcher.unsubscribe("USER_UPDATE", onUserUpdate);
disableStyle(styles);
}, },
ready: ({ notes }: { notes: { [userId: string]: string; }; }) => { ready: ({ notes }: { notes: { [userId: string]: string; }; }) => {