From 336f88d89c822ec9a06003a13582b527d87f213f Mon Sep 17 00:00:00 2001
From: Nuwan
Date: Tue, 27 Jan 2026 23:05:53 +0530
Subject: [PATCH] refactor(11-01): polish edge cases and add PropTypes
Polish edge case handling and add missing PropTypes for textarea ref.
- JKChatComposer: Add PropTypes for textareaRef prop, add defaultProps
- JKChatEmptyState: Update message to match plan spec ("Start the conversation!")
- Verified edge cases: clearSendError works with retry, rapid actions handled, empty states work
- All edge cases from plan verified: disconnection, long messages, rapid toggling, multiple unread
Co-Authored-By: Claude Sonnet 4.5
---
jam-ui/src/components/client/chat/JKChatComposer.js | 9 +++++++++
jam-ui/src/components/client/chat/JKChatEmptyState.js | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/jam-ui/src/components/client/chat/JKChatComposer.js b/jam-ui/src/components/client/chat/JKChatComposer.js
index e8bd44734..8a6dc1f20 100644
--- a/jam-ui/src/components/client/chat/JKChatComposer.js
+++ b/jam-ui/src/components/client/chat/JKChatComposer.js
@@ -1,4 +1,5 @@
import React, { useState, useCallback, useMemo } from 'react';
+import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux';
import { sendMessage, selectSendStatus, selectSendError, clearSendError } from '../../../store/features/sessionChatSlice';
import { selectSessionId } from '../../../store/features/activeSessionSlice';
@@ -221,4 +222,12 @@ const JKChatComposer = ({ textareaRef }) => {
);
};
+JKChatComposer.propTypes = {
+ textareaRef: PropTypes.object
+};
+
+JKChatComposer.defaultProps = {
+ textareaRef: null
+};
+
export default React.memo(JKChatComposer);
diff --git a/jam-ui/src/components/client/chat/JKChatEmptyState.js b/jam-ui/src/components/client/chat/JKChatEmptyState.js
index 8d8894c8d..91ba47a8b 100644
--- a/jam-ui/src/components/client/chat/JKChatEmptyState.js
+++ b/jam-ui/src/components/client/chat/JKChatEmptyState.js
@@ -22,7 +22,7 @@ const JKChatEmptyState = () => {
No messages yet
- Be the first to send a message in this chat!
+ Start the conversation!
);