MCPcopy Create free account
hub / github.com/async-labs/async / loadThreadMessagesStoreMethod

Method loadThreadMessagesStoreMethod

app/lib/store/Message.ts:196–223  ·  view source on GitHub ↗
(chatId: string, messageId: string, teamId: string)

Source from the content-addressed store, hash-verified

194 }
195
196 public async loadThreadMessagesStoreMethod(chatId: string, messageId: string, teamId: string) {
197 if (this.isLoadingThreadMessages || this.store.isServer) {
198 return;
199 }
200
201 this.isLoadingThreadMessages = true;
202
203 try {
204 const { messagesInsideThread = [] } = await getThreadMessagesApiMethod({
205 chatId,
206 messageId,
207 teamId,
208 });
209
210 runInAction(() => {
211 const messageObjs = messagesInsideThread.map(
212 (m) => new Message({ chat: this, store: this.store, team: this.team, ...m }),
213 );
214 this.messagesInsideThread.replace(messageObjs);
215 });
216 } catch (err) {
217 console.log(err);
218 } finally {
219 runInAction(() => {
220 this.isLoadingThreadMessages = false;
221 });
222 }
223 }
224}
225
226export { Message };

Callers 1

ChatDetailClass · 0.80

Calls 1

Tested by

no test coverage detected