🐛 fix(message): ensure retry uses current selected model instead of stale one
- 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.
This commit is contained in:
@@ -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
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user