Skip to content

Commit 379309c

Browse files
committed
perf(web): keep parent updates out of side chats
1 parent 15fe283 commit 379309c

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,6 +3186,11 @@ export default function ChatView(props: ChatViewProps) {
31863186
(folders: Parameters<ChatComposerHandle["addDroppedFolders"]>[0]) =>
31873187
composerRef.current?.addDroppedFolders(folders),
31883188
);
3189+
// Above the early return, where React Compiler can cache it for the side chat pane.
3190+
const sideChatParentPanel = {
3191+
openToolDiff: onOpenToolDiffStable,
3192+
runShellCommand: runSideChatShellCommandStable,
3193+
};
31893194

31903195
if (!activeThread) {
31913196
return embedded ? null : <NoActiveThreadState />;
@@ -3205,10 +3210,7 @@ export default function ChatView(props: ChatViewProps) {
32053210
getShortcutContext={getShortcutContextStable}
32063211
onSendAnnotation={sendPreviewAnnotationStable}
32073212
onCloseSurface={closeRightPanelSurface}
3208-
sideChatParentPanel={{
3209-
openToolDiff: onOpenToolDiffStable,
3210-
runShellCommand: runSideChatShellCommandStable,
3211-
}}
3213+
sideChatParentPanel={sideChatParentPanel}
32123214
terminal={{
32133215
launchContext: activeTerminalLaunchContext ?? null,
32143216
keybindings,

‎apps/web/src/components/chat/RightPanelSurfaceContent.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function RightPanelSurfaceContent(props: {
7979
readonly files: RightPanelFileProps;
8080
readonly sideChatParentPanel: SideChatParentPanel;
8181
}) {
82-
const { surface, threadRef, visible } = props;
82+
const { surface, threadRef, visible, onCloseSurface } = props;
8383
if (surface === null) return null;
8484
switch (surface.kind) {
8585
case "preview":
@@ -176,7 +176,7 @@ export function RightPanelSurfaceContent(props: {
176176
parentRef={threadRef}
177177
threadId={surface.threadId}
178178
parentPanel={props.sideChatParentPanel}
179-
onClose={() => props.onCloseSurface(surface)}
179+
onClose={() => onCloseSurface(surface)}
180180
/>
181181
);
182182
case "device":

0 commit comments

Comments
 (0)