Skip to content

fix: preserve emoji when saving assistant to library#13371

Merged
DeJeune merged 1 commit intoCherryHQ:mainfrom
kovsu:fix-#13367
Mar 12, 2026
Merged

fix: preserve emoji when saving assistant to library#13371
DeJeune merged 1 commit intoCherryHQ:mainfrom
kovsu:fix-#13367

Conversation

@kovsu
Copy link
Copy Markdown
Collaborator

@kovsu kovsu commented Mar 11, 2026

Fixes #13367

  • Migration v73 moves leading emoji from assistant.name into assistant.emoji and trims the
    name.
  • The save-to-library flow still omits emoji, which now drops the migrated value.

Copy link
Copy Markdown
Collaborator

@GeorgeDong32 GeorgeDong32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ⚠️ Not included Would benefit from a test verifying emoji preservation
Documentation ✅ Pass PR description clearly explains the issue

Recommendations

  1. (Optional) Add test coverage: Consider adding a unit test that verifies the `emoji` field is preserved when saving to library.

  2. (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

@DeJeune DeJeune added the ready-to-merge This PR has sufficient reviewer approvals but is awaiting code owner approval. label Mar 12, 2026
@DeJeune DeJeune merged commit b06d32e into CherryHQ:main Mar 12, 2026
12 checks passed
@kovsu kovsu deleted the fix-#13367 branch March 12, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has sufficient reviewer approvals but is awaiting code owner approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: The 'save to assistant library' feature does not save emojis

3 participants