From cd759d8a09674efaef96c89c12e15d4dfda5f7a2 Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Wed, 30 Sep 2026 03:40:08 +0800 Subject: [PATCH] chore(web): document allocation-free duplicate dispatch paths --- .../ui-conversation/src/client/conversation/assembler.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/client/ui-conversation/src/client/conversation/assembler.ts b/packages/client/ui-conversation/src/client/conversation/assembler.ts index 6bd8ec1d3e..6ead68c793 100644 --- a/packages/client/ui-conversation/src/client/conversation/assembler.ts +++ b/packages/client/ui-conversation/src/client/conversation/assembler.ts @@ -502,12 +502,15 @@ export class ConversationNodeAssembler implements ConversationViewSnapshotStore for (const definition of this.eventDefinitions.entries()) { const result = definition.match(event) if (result === null) continue + // Inline target tracking avoids an additional closure allocation for each event. + /* jscpd:ignore-start */ if (definition.target !== undefined && definition.target !== firstTarget && definition.target !== secondTarget) { if (firstTarget === undefined) firstTarget = definition.target else if (secondTarget === undefined) secondTarget = definition.target else (otherTargets ??= new Set()).add(definition.target) } publication = maximumPublication(publication, accept.call(this, definition, result.id, matchFor(result.role))) + /* jscpd:ignore-end */ } } else { for (const { definition, match } of routes) {