MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / editMessage

Function editMessage

apps/web/ui/ThreadView/Content/index.tsx:105–129  ·  view source on GitHub ↗
({ id, body }: { id: string; body: string })

Source from the content-addressed store, hash-verified

103 };
104
105 const editMessage = ({ id, body }: { id: string; body: string }) => {
106 setThread((thread: SerializedThread) => {
107 return {
108 ...thread,
109 messages: thread.messages.map((message: SerializedMessage) => {
110 if (message.id === id) {
111 return {
112 ...message,
113 body,
114 };
115 }
116 return message;
117 }),
118 };
119 });
120 return api
121 .updateMessage({
122 accountId: settings.communityId,
123 id,
124 body,
125 })
126 .catch((_) => {
127 Toast.error('Failed to update the message.');
128 });
129 };
130
131 const debouncedCreateMessage = useCallback(
132 debounce(api.createMessage, 100),

Callers 1

ThreadFunction · 0.50

Calls 3

mapMethod · 0.80
updateMessageMethod · 0.80
errorMethod · 0.65

Tested by

no test coverage detected