MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / bindReaction

Method bindReaction

packages/bot/src/thread.ts:90–103  ·  view source on GitHub ↗

* Wire a posted message's `onReaction` to its returned id: cache it for this * process and, when it came from a component, persist a durable snapshot so a * reaction after a restart re-derives it (parity with a component `onClick`).

(
    messageId: string,
    bound: Awaited<ReturnType<Thread["bindForPost"]>>,
  )

Source from the content-addressed store, hash-verified

88 * reaction after a restart re-derives it (parity with a component `onClick`).
89 */
90 private async bindReaction(
91 messageId: string,
92 bound: Awaited<ReturnType<Thread["bindForPost"]>>,
93 ): Promise<void> {
94 if (bound.onReaction) {
95 this.deps.registry.registerMessageReaction(messageId, bound.onReaction);
96 }
97 if (bound.reactionComponent) {
98 await this.deps.registry.persistMessageReaction(messageId, {
99 ...bound.reactionComponent,
100 conversationKey: this.deps.conversationKey,
101 });
102 }
103 }
104
105 async post(ui: Renderable): Promise<MessageRef> {
106 const bound = await this.bindForPost(ui);

Callers 2

postMethod · 0.95
updateMethod · 0.95

Calls 2

Tested by

no test coverage detected