aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/previewMessage.tsx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/previewMessage.tsx b/src/plugins/previewMessage.tsx
index 2653318..9bea221 100644
--- a/src/plugins/previewMessage.tsx
+++ b/src/plugins/previewMessage.tsx
@@ -20,7 +20,7 @@ import { sendBotMessage } from "@api/Commands";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
-import { Button, ButtonLooks, ButtonWrapperClasses, DraftStore, DraftType, SelectedChannelStore, Tooltip, UserStore } from "@webpack/common";
+import { Button, ButtonLooks, ButtonWrapperClasses, DraftStore, DraftType, SelectedChannelStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
interface Props {
type: {
@@ -31,10 +31,9 @@ interface Props {
const getDraft = (channelId: string) => DraftStore.getDraft(channelId, DraftType.ChannelMessage);
export function PreviewButton(chatBoxProps: Props) {
- if (chatBoxProps.type.analyticsName !== "normal") return null;
const channelId = SelectedChannelStore.getChannelId();
- const draft = getDraft(channelId);
-
+ const draft = useStateFromStores([DraftStore], () => getDraft(channelId));
+ if (chatBoxProps.type.analyticsName !== "normal") return null;
if (!draft) return null;
return (