fix: preserve emoji when saving assistant to library#13371
fix: preserve emoji when saving assistant to library#13371DeJeune merged 1 commit intoCherryHQ:mainfrom
Conversation
GeorgeDong32
left a comment
There was a problem hiding this comment.
Code Review Summary
PR Title: fix: preserve emoji when saving assistant to library
Author: kovsu
Related Issue: #13367
Overview
This PR addresses an issue where migration v73 moved leading emoji from `assistant.name` into `assistant.emoji` and trimmed the name. The save-to-library flow was omitting the `emoji` field, causing the migrated value to be lost.
Files Changed (2)
| File | Change Type |
|---|---|
| `src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx` | Bug fix - Remove `emoji` from omit list |
| `src/renderer/src/pages/settings/DisplaySettings/SidebarIconsManager.tsx` | UI improvement - Replace `Bot` icon with custom `OpenClawSidebarIcon` |
Review Analysis
1. Main Fix: AssistantItem.tsx (Line 317)
```diff
- const preset = omit(assistant, ['model', 'emoji'])
- const preset = omit(assistant, ['model'])
```
Assessment: ✅ Correct and Minimal
- The fix correctly preserves the `emoji` field when saving an assistant to the library
- Follows the migration pattern established in v73
- Change is minimal and focused on the specific issue
- The `model` field is still correctly excluded (likely to allow library items to have their own model selection)
Logic Verification:
- The `omit()` function from lodash creates a new object without the specified keys
- Previously, `emoji` was being stripped, causing data loss after migration
- Now the emoji is preserved in the saved preset
2. SidebarIconsManager.tsx - Icon Update
```diff
- import { Bot, ... } from 'lucide-react'
- import { OpenClawSidebarIcon } from '@renderer/components/Icons/SVGIcon'
...
- openclaw:
- openclaw: <OpenClawSidebarIcon style={{ width: 16, height: 16 }} />
```
Assessment: ✅ Acceptable (minor UI improvement)
- While not directly related to the emoji preservation fix, this is a reasonable UI polish
- Uses consistent import pattern for custom icons
- Properly styled with inline styles for sizing
Note: This change seems unrelated to the main PR purpose but is harmless and improves UI consistency.
Checklist Evaluation
| Category | Status | Notes |
|---|---|---|
| Logic correctness | ✅ Pass | Fix properly addresses the data loss issue |
| Code quality | ✅ Pass | Minimal, focused change following existing patterns |
| Security | ✅ Pass | No security concerns |
| Performance | ✅ Pass | No performance impact |
| Error handling | N/A | Not applicable for this simple property change |
| Test coverage | Would benefit from a test verifying emoji preservation | |
| Documentation | ✅ Pass | PR description clearly explains the issue |
Recommendations
-
(Optional) Add test coverage: Consider adding a unit test that verifies the `emoji` field is preserved when saving to library.
-
(Optional) Separate concerns: The SidebarIconsManager change could be in a separate PR for cleaner git history, but it's acceptable as-is for a small UI fix.
Verdict
✅ Approved
This is a clean, minimal fix that directly addresses the reported issue. The code follows existing patterns and introduces no regressions. The change is safe to merge.
Reviewed by kimi-k2.5
Fixes #13367
assistant.nameintoassistant.emojiand trims thename.
emoji, which now drops the migrated value.