[PR #370] [MERGED] fix(chat): hide deleted characters from group trigger response menu #4585

Closed
opened 2026-10-22 04:08:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/370
Author: @cha1latte
Created: 5/3/2026
Status: ✅ Merged
Merged: 5/3/2026
Merged by: @SpicyMarinara

Base: main ← Head: fix/group-chat-trigger-response-deleted-chars


📝 Commits (1)

  • 51861a3 fix(chat): hide deleted characters from group trigger response menu

📊 Changes

2 files changed (+24 additions, -20 deletions)

View changed files

📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+11 -9)
📝 packages/client/src/components/chat/ConversationView.tsx (+13 -11)

📄 Description

Summary

In group chats with Individual + Manual response mode, deleted character cards appeared as "Unknown" entries in the trigger response picker (the button between emote and send). Users had no way to remove them since the deleted characters no longer existed under Chat Settings → Characters.

This fix filters out IDs whose characters no longer exist before rendering the picker, matching the convention already used by the chat settings drawer.

Reported in: Discord

Why

The server's DELETE /characters/:id route intentionally does not cascade-clean chat.characterIds arrays in existing chats. The client convention is to tolerate dangling IDs by filtering on render — this is what ChatSettingsDrawer.tsx:1383-1384 already does (if (!c) return null).

The trigger response picker was the one render path that didn't follow this convention. Instead of filtering, it mapped every ID and fell back to name: "Unknown", producing visible-but-uninteractable phantom entries.

What changed

Two files, identical fix pattern:

  • ChatRoleplaySurface.tsx — chatCharacters prop now .filter()s by characterMap.has(id) before mapping.
  • ConversationView.tsx — same filter applied to the conversation-mode surface.

No server changes. No schema changes. No new tests (no automated test suite for this surface).

Edge cases

  • If enough characters get deleted that fewer than 2 valid characters remain, the trigger button correctly disappears (the picker visibility gate already checks chatCharacters.length > 1 after filtering).
  • Pre-existing related issue (out of scope for this PR): the "Characters" section count badge in the chat settings drawer reads raw chatCharIds.length and can be off-by-one when stale IDs exist. Will file as a separate follow-up.

Test plan

Manual verification on Windows test install (port 7820), Roleplay mode group chat, Individual + Manual response order:

  • Created a group chat with 3 characters, confirmed trigger response menu lists all 3
  • Deleted one character from the Characters panel
  • Reopened the chat → confirmed the trigger response menu now shows only the 2 remaining characters (no "Unknown" entry)
  • Verified at light mode and dark mode
  • Verified at ~400px viewport width (mobile)
  • Confirmed pnpm check passes locally

Screenshots

Before (current bug — two deleted characters appear as "Unknown"):
image

After (this PR — only valid characters listed):
image

Summary by CodeRabbit

  • Bug Fixes
    • Improved chat character display to only show valid characters that exist in the system, removing placeholder entries for missing characters.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/370 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/3/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `fix/group-chat-trigger-response-deleted-chars` --- ### 📝 Commits (1) - [`51861a3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/51861a3db92cc3af2883b1071a92145f54de6ec1) fix(chat): hide deleted characters from group trigger response menu ### 📊 Changes **2 files changed** (+24 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+11 -9) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+13 -11) </details> ### 📄 Description ## Summary In group chats with Individual + Manual response mode, deleted character cards appeared as "Unknown" entries in the trigger response picker (the button between emote and send). Users had no way to remove them since the deleted characters no longer existed under Chat Settings → Characters. This fix filters out IDs whose characters no longer exist before rendering the picker, matching the convention already used by the chat settings drawer. Reported in: [Discord](https://discord.com/channels/1417099416812392641/1499649588066517133) ## Why The server's `DELETE /characters/:id` route intentionally does not cascade-clean `chat.characterIds` arrays in existing chats. The client convention is to tolerate dangling IDs by filtering on render — this is what `ChatSettingsDrawer.tsx:1383-1384` already does (`if (!c) return null`). The trigger response picker was the one render path that didn't follow this convention. Instead of filtering, it mapped every ID and fell back to `name: "Unknown"`, producing visible-but-uninteractable phantom entries. ## What changed Two files, identical fix pattern: - `ChatRoleplaySurface.tsx` — `chatCharacters` prop now `.filter()`s by `characterMap.has(id)` before mapping. - `ConversationView.tsx` — same filter applied to the conversation-mode surface. No server changes. No schema changes. No new tests (no automated test suite for this surface). ## Edge cases - If enough characters get deleted that fewer than 2 valid characters remain, the trigger button correctly disappears (the picker visibility gate already checks `chatCharacters.length > 1` after filtering). - Pre-existing related issue (out of scope for this PR): the "Characters" section count badge in the chat settings drawer reads raw `chatCharIds.length` and can be off-by-one when stale IDs exist. Will file as a separate follow-up. ## Test plan Manual verification on Windows test install (port 7820), Roleplay mode group chat, Individual + Manual response order: - [x] Created a group chat with 3 characters, confirmed trigger response menu lists all 3 - [x] Deleted one character from the Characters panel - [x] Reopened the chat → confirmed the trigger response menu now shows only the 2 remaining characters (no "Unknown" entry) - [x] Verified at light mode and dark mode - [x] Verified at ~400px viewport width (mobile) - [x] Confirmed `pnpm check` passes locally ## Screenshots **Before** (current bug — two deleted characters appear as "Unknown"): <img width="764" height="758" alt="image" src="https://github.com/user-attachments/assets/6e4f2b7c-c8bc-4d53-9939-d0f0d2824275" /> **After** (this PR — only valid characters listed): <img width="225" height="143" alt="image" src="https://github.com/user-attachments/assets/0677c434-d01b-4437-b451-c5b9cd8f7f15" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved chat character display to only show valid characters that exist in the system, removing placeholder entries for missing characters. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:55 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4585
No description provided.