Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(channel): Unable to send message (#730)

dev-rb60ca3ea5b339
diff --git a/js/app/packages/block-channel/component/ChannelInput.tsx b/js/app/packages/block-channel/component/ChannelInput.tsx
index d89f5be68f..b98a6d0986 100644
--- a/js/app/packages/block-channel/component/ChannelInput.tsx
+++ b/js/app/packages/block-channel/component/ChannelInput.tsx
@@ -33,7 +33,7 @@ export type ChannelInputProps = {
export function ChannelInput(props: ChannelInputProps) {
const channelId = useBlockId();
- const sendMessage = useSendChannelMessageAction();
+ const sendMessage = useSendChannelMessageAction(() => channelId);
const postTypingUpdate_ = createCallback(postTypingUpdate);
diff --git a/js/app/packages/block-channel/component/ReplyInputsPortaler.tsx b/js/app/packages/block-channel/component/ReplyInputsPortaler.tsx
index 89519a5a2f..feffcadc30 100644
--- a/js/app/packages/block-channel/component/ReplyInputsPortaler.tsx
+++ b/js/app/packages/block-channel/component/ReplyInputsPortaler.tsx
@@ -38,7 +38,7 @@ export type ReplyInputsPortalerProps = {
export function ReplyInputsPortaler(props: ReplyInputsPortalerProps) {
const listContext = useMessageListContext();
- const sendMessage = useSendChannelMessageAction();
+ const sendMessage = useSendChannelMessageAction(() => props.channelId);
const postTypingUpdate_ = createCallback(postTypingUpdate);
const blockRef = blockElementSignal.get;
diff --git a/js/app/packages/block-channel/signal/channel.ts b/js/app/packages/block-channel/signal/channel.ts
index c0ef753472..d8048b6864 100644
--- a/js/app/packages/block-channel/signal/channel.ts
+++ b/js/app/packages/block-channel/signal/channel.ts
@@ -23,6 +23,7 @@ import { useUserId } from '@service-gql/client';
import { blockNameToItemType } from '@service-storage/client';
import { createCallback } from '@solid-primitives/rootless';
import { toast } from 'core/component/Toast/Toast';
+import type { Accessor } from 'solid-js';
import { updateActivityOnMessageReceived } from './activity';
import { initializeAttachments, messageAttachmentsStore } from './attachment';
import { messageToReactionStore } from './reactions';
@@ -207,7 +208,7 @@ export type SendMessageArgs = {
mentions?: SimpleMention[];
};
-export function useSendChannelMessageAction() {
+export function useSendChannelMessageAction(channelID: Accessor<string>) {
const optimisticSend = createCallback(optimisticChannelMessage);
const channelsContext = useChannelsContext();
const userId = useUserId();
@@ -235,8 +236,8 @@ export function useSendChannelMessageAction() {
}: SendMessageArgs) => {
if (!userId) return;
if (!isMessageSendable(content, attachments)) return;
- const channelId = channelStore.get.id;
- if (!channelId) return;
+
+ const channelId = channelID();
const attachmentsToSend = await Promise.allSettled(
attachments.map(async (a) => {