From 2250f35a7e84158a03b4a94ef5bafe5cc20fe7b8 Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Tue, 3 Jun 2025 00:45:28 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(message):=20ensure=20retry?= =?UTF-8?q?=20uses=20current=20selected=20model=20instead=20of=20stale=20o?= =?UTF-8?q?ne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add onMessageReset reference comparison to OptimizedMessageActions memo - Force component re-render when model selection changes - Prevent stale closure issue in retry functionality - Ensure first retry attempt uses newly selected model Previously, when changing the model selection, the retry button would still use the previous model due to React memo optimization preventing re-renders. By comparing the onMessageReset callback reference, the component now properly updates when the model changes, ensuring the retry functionality immediately uses the currently selected model. --- web/src/components/playground/OptimizedComponents.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/components/playground/OptimizedComponents.js b/web/src/components/playground/OptimizedComponents.js index 92b57bec..9ba2a7c7 100644 --- a/web/src/components/playground/OptimizedComponents.js +++ b/web/src/components/playground/OptimizedComponents.js @@ -26,7 +26,8 @@ export const OptimizedMessageActions = React.memo(MessageActions, (prevProps, ne prevProps.message.id === nextProps.message.id && prevProps.message.role === nextProps.message.role && prevProps.isAnyMessageGenerating === nextProps.isAnyMessageGenerating && - prevProps.isEditing === nextProps.isEditing + prevProps.isEditing === nextProps.isEditing && + prevProps.onMessageReset === nextProps.onMessageReset ); });