Repository navigation
Fix: Add a waiting status to the messages on the chat page. - #15773
Conversation
📝 WalkthroughWalkthroughThe PR updates ChangesMessage loading state placeholder
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/src/components/message-item/index.tsx (1)
13-13: ⚡ Quick winConsider a simpler empty check for strings.
Since
messageContentis a string (line 71), you can use!messageContentinstead of importing and callingisEmpty. This reduces the dependency on lodash for a simple check.♻️ Simpler alternative
Remove the import:
-import { isEmpty } from 'lodash';And update line 149:
- {sendLoading && isEmpty(messageContent) ? ( + {sendLoading && !messageContent ? (🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/components/message-item/index.tsx` at line 13, Remove the unnecessary lodash dependency by deleting the import of isEmpty and replace its usage with a simple falsy check on the string variable messageContent (e.g., use !messageContent where isEmpty(messageContent) was used). Locate occurrences in the MessageItem component (reference symbol: messageContent) and update them to use the simpler boolean check, ensuring no other code relies on isEmpty; then remove the now-unused import statement.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/components/message-item/index.tsx`:
- Around line 149-158: Hardcoded loading text 'running...' must be
internationalized: import and call the react-i18next useTranslation hook in this
component (e.g., const { t } = useTranslation()), replace the literal string in
the conditional that uses sendLoading && isEmpty(messageContent) with
t('chat.running') (or reuse an existing key like t('chat.searching') if
appropriate), and add the chat.running key to your i18n resource files for all
supported languages; ensure MarkdownContent usage and surrounding logic
(sendLoading, isEmpty, messageContent) remain unchanged.
---
Nitpick comments:
In `@web/src/components/message-item/index.tsx`:
- Line 13: Remove the unnecessary lodash dependency by deleting the import of
isEmpty and replace its usage with a simple falsy check on the string variable
messageContent (e.g., use !messageContent where isEmpty(messageContent) was
used). Locate occurrences in the MessageItem component (reference symbol:
messageContent) and update them to use the simpler boolean check, ensuring no
other code relies on isEmpty; then remove the now-unused import statement.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dac704d2-fdae-4b0f-a534-3efc39c1e3c4
📒 Files selected for processing (1)
web/src/components/message-item/index.tsx
| {sendLoading && isEmpty(messageContent) ? ( | ||
| 'running...' | ||
| ) : ( | ||
| <MarkdownContent | ||
| loading={loading} | ||
| content={messageContent} | ||
| reference={reference} | ||
| clickDocumentButton={clickDocumentButton} | ||
| ></MarkdownContent> | ||
| )} |
There was a problem hiding this comment.
Internationalize the loading placeholder text.
The hardcoded 'running...' string violates the project's i18n requirement. As per coding guidelines, this project uses react-i18next for internationalization supporting 17 languages, and the useTranslation hook should be used for all user-facing strings.
🌐 Recommended fix
Import the translation hook at the top of the component (around line 55):
}: IProps) => {
+ const { t } = useTranslation();
const { theme } = useTheme();Then update the placeholder:
- {sendLoading && isEmpty(messageContent) ? (
- 'running...'
+ {sendLoading && !messageContent ? (
+ t('chat.running')
) : (You'll also need to add the translation key chat.running to your i18n resource files for all 17 supported languages. Alternatively, check if there's an existing similar key like chat.searching (used in MarkdownContent per context) that could be reused.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/components/message-item/index.tsx` around lines 149 - 158, Hardcoded
loading text 'running...' must be internationalized: import and call the
react-i18next useTranslation hook in this component (e.g., const { t } =
useTranslation()), replace the literal string in the conditional that uses
sendLoading && isEmpty(messageContent) with t('chat.running') (or reuse an
existing key like t('chat.searching') if appropriate), and add the chat.running
key to your i18n resource files for all supported languages; ensure
MarkdownContent usage and surrounding logic (sendLoading, isEmpty,
messageContent) remain unchanged.
Source: Coding guidelines
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15773 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What problem does this PR solve?
Fix: Add a waiting status to the messages on the chat page.
Type of change