aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/previewMessage.tsx
diff options
context:
space:
mode:
authorHugo C <lumap@duck.com>2023-09-05 19:45:44 +0200
committerGitHub <noreply@github.com>2023-09-05 19:45:44 +0200
commitfaeb4fb5856a03c75329162ff3384645075a0c07 (patch)
tree2e45cf553b3b1d2cd4ef0d26be21fc60ec1e62c2 /src/plugins/previewMessage.tsx
parent0d18b44ba7b9ac6d30eda385db8eab56e4d33b42 (diff)
downloadVencord-faeb4fb5856a03c75329162ff3384645075a0c07.tar.gz
Vencord-faeb4fb5856a03c75329162ff3384645075a0c07.tar.bz2
Vencord-faeb4fb5856a03c75329162ff3384645075a0c07.zip
previewMessage: Hide the button once a message is sent (#1692)
Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'src/plugins/previewMessage.tsx')
-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 (