Skip to content

Commit 63130a3

Browse files
CopilotOEvgeny
andauthored
perf: schedule pendingFrozenCheckRef only after confirming append-only with content changes
Agent-Logs-Url: https://github.com/microsoft/BotFramework-WebChat/sessions/d07bf01e-33c1-440a-a28e-095207d61357 Co-authored-by: OEvgeny <2841858+OEvgeny@users.noreply.github.com>
1 parent 3f82f60 commit 63130a3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/api/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ const ActivityKeyerComposer = ({ children }: Readonly<{ children?: ReactNode | u
8686
commonPrefixLength++;
8787
}
8888

89-
// Schedule deferred verification of the frozen portion if any was skipped.
90-
pendingFrozenCheckRef.current = frozenBoundary
91-
? Object.freeze({ current: activities, frozenBoundary, prev: prevActivities })
92-
: undefined;
93-
9489
const isAppendOnly = commonPrefixLength === prevActivities.length;
9590

9691
if (isAppendOnly) {
@@ -102,6 +97,12 @@ const ActivityKeyerComposer = ({ children }: Readonly<{ children?: ReactNode | u
10297
return prevActivityKeysStateRef.current;
10398
}
10499

100+
// Schedule deferred verification of the frozen portion only now that we know:
101+
// (1) the update is append-only and (2) there are actual content changes.
102+
if (frozenBoundary) {
103+
pendingFrozenCheckRef.current = Object.freeze({ current: activities, frozenBoundary, prev: prevActivities });
104+
}
105+
105106
const { current: activityIdToKeyMap } = activityIdToKeyMapRef;
106107
const { current: activityToKeyMap } = activityToKeyMapRef;
107108
const { current: clientActivityIdToKeyMap } = clientActivityIdToKeyMapRef;

0 commit comments

Comments
 (0)