@marketrix.ai/widget 4.0.115 → 4.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
* the allow/deny controls of a screen-access request, and a done/failed/stopped glyph in the tenant
|
|
6
6
|
* accent at a per-status opacity. The last message fades in.
|
|
7
7
|
*
|
|
8
|
+
* **Memoized, and `isTaskRunning` arrives as a prop rather than through `useWidget()`.** `MessageList`
|
|
9
|
+
* commits a whole new `messages` array on every `chat/delta` token (`ChatContext`'s reducer keeps
|
|
10
|
+
* reference equality for every message except the one being streamed into), so a `useWidget()`/
|
|
11
|
+
* `useChatContext()` call anywhere inside a list row re-subscribes that row to the token stream directly
|
|
12
|
+
* and defeats `React.memo` regardless of props — measured at ~21 `MessageItem`/`MessageBody` renders per
|
|
13
|
+
* token in a 20-message transcript before this change (one per row), ~1 after (only the streaming row).
|
|
14
|
+
* `onScreenAccessAllow`/`onScreenAccessDeny` must stay referentially stable (`ChatView`'s `useScreenShare`
|
|
15
|
+
* wraps them for exactly this) or the memo comparison never bails.
|
|
16
|
+
*
|
|
8
17
|
* `MessageBody` renders the message's `parts` — text and progress lines — and `Thinking` is the
|
|
9
18
|
* spinner-and-caption row shown while a reply is pending, its caption switching to name the visitor's
|
|
10
19
|
* action when the agent is blocked on them. Thinking shows while a placeholder carries no text yet, and
|
|
@@ -16,8 +25,9 @@ import type { ChatMessage } from '../../types';
|
|
|
16
25
|
interface MessageItemProps {
|
|
17
26
|
message: ChatMessage;
|
|
18
27
|
isLastMessage: boolean;
|
|
28
|
+
isTaskRunning: boolean;
|
|
19
29
|
onScreenAccessAllow?: () => void;
|
|
20
30
|
onScreenAccessDeny?: () => void;
|
|
21
31
|
}
|
|
22
|
-
export declare const MessageItem: React.
|
|
32
|
+
export declare const MessageItem: React.NamedExoticComponent<MessageItemProps>;
|
|
23
33
|
export {};
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
* `useScreenShare` (this file's only other consumer) owns the screen-share lifecycle: the in-transcript
|
|
22
22
|
* permission card, the browser picker, the live share message, and ending a share. `useLatest` keeps a
|
|
23
23
|
* value readable from a callback that must not be re-created (the polling interval below, mounted once);
|
|
24
|
-
its refs are listed in that effect's deps for the linter, but since `useRef` identity never changes,
|
|
25
|
-
listing them cannot re-arm the interval.
|
|
24
|
+
* its refs are listed in that effect's deps for the linter, but since `useRef` identity never changes,
|
|
25
|
+
* listing them cannot re-arm the interval. The same idiom stabilizes `handleScreenAccessRequestAllow`/
|
|
26
|
+
* `handleScreenAccessRequestDeny`: both are handed to every `MessageItem` through `MessageList`, and a
|
|
27
|
+
* fresh closure each render (the naive `beginScreenShare`/inline-arrow form) defeats `MessageItem`'s
|
|
28
|
+
* `React.memo` for the whole transcript on every SSE token, not just the streaming row.
|
|
26
29
|
* The hook returns `requestScreenAccess` — posting a request card carrying the queued turn, no-oping if
|
|
27
30
|
* one is already open — plus that card's Allow/Deny handlers, the toolbar dialog's Allow/Dismiss
|
|
28
31
|
* handlers, and `toggleScreenShareRef`, a toggle stopping a live share or opening that dialog.
|