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 <noreply@anthropic.com>
This commit is contained in:
Nuwan 2026-01-27 23:05:53 +05:30
parent d39dcf36fd
commit 336f88d89c
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -22,7 +22,7 @@ const JKChatEmptyState = () => {
No messages yet
</p>
<p style={{ fontSize: '14px', margin: 0 }}>
Be the first to send a message in this chat!
Start the conversation!
</p>
</div>
);