[PR #6825] [MERGED] fix(chat): hide the previous swipe's translation while regenerating #7345

Closed
opened 2026-10-23 04:18:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6825
Author: @SpicyMarinara
Created: 9/28/2026
Status: ✅ Merged
Merged: 9/28/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/roleplay-regen-stale-translation


📝 Commits (1)

  • 9c82932 fix(chat): hide the previous swipe's translation while regenerating

📊 Changes

2 files changed (+8 additions, -1 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/client/src/components/chat/ChatMessage.tsx (+6 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6824

Why this change

  • Translations are stored per message, not per swipe. When a translated reply is regenerated, the old swipe's translation stays under a divider while the new reply streams, so it looks as if the new text is being written on top of the old swipe. Once the reply finishes, the new swipe keeps the old translation.

What changed

  • ChatMessage shows a stored translation only for the text it was made from (translationSource === message.content, or an unknown source for older data), and never while the message is streaming. This is the rule the Translate button already uses to decide whether a translation belongs to the current text.
  • Swiping back to the translated swipe shows its translation again. Nothing is deleted from the translation store.
  • One Unreleased changelog entry.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated checks run locally on 9c82932c0:

  • Client tsc --noEmit, ESLint on ChatMessage.tsx, and Prettier on changed files: clean. The full pnpm check was not run locally because the maintainer asked for this urgently. CI pnpm-validate covers it.
  • Temporary Playwright proof, removed per repo policy, on desktop Chromium, mobile Chromium and mobile WebKit. It seeded a translation for the current swipe, regenerated with a held stream, and checked:
    • no old translation while streaming;
    • none on the saved new swipe;
    • the translation returns after swiping back.
      It passed 3/3 with the fix and failed without it ("no old translation during the stream").
  • Existing e2e/translation-only.e2e.ts passed 9/9.
  • Local CodeRabbit review was skipped because of the maintainer's ASAP request. The hosted CodeRabbit check remains a merge gate.

Manual verification notes

  • Manually verify on iPhone: translate a roleplay reply, regenerate it, and confirm only the new text streams, with no divider and no old translation.
  • Manually verify the new swipe has no translation afterward, and that swiping back to the old swipe shows its translation again.
  • Manually verify "Show translation only" still replaces the text with its translation when it matches.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Only CHANGELOG.md changes. There are no user-facing docs or release metadata changes.

UI evidence (if applicable)

Before the fix, the new stream shows on top, then a divider, then the old swipe's translation. The Playwright capture from mobile WebKit looks the same as the maintainer's iPhone screenshots. After the fix, only the stream is shown.

Summary by CodeRabbit

  • Bug Fixes
    • Translations are hidden while a reply is being regenerated and new text is streaming.
    • A regenerated reply no longer displays the previous swipe’s translation. Returning to the previous swipe still shows its translation.
    • Translations are shown only when they match the current message text, unless no source text was recorded.

🔄 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/6825 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/28/2026 **Status:** ✅ Merged **Merged:** 9/28/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/roleplay-regen-stale-translation` --- ### 📝 Commits (1) - [`9c82932`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9c82932c0d76d432d3fba86f86ac027684b384ff) fix(chat): hide the previous swipe's translation while regenerating ### 📊 Changes **2 files changed** (+8 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+6 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #6824 ## Why this change - Translations are stored per message, not per swipe. When a translated reply is regenerated, the old swipe's translation stays under a divider while the new reply streams, so it looks as if the new text is being written on top of the old swipe. Once the reply finishes, the new swipe keeps the old translation. ## What changed - `ChatMessage` shows a stored translation only for the text it was made from (`translationSource === message.content`, or an unknown source for older data), and never while the message is streaming. This is the rule the Translate button already uses to decide whether a translation belongs to the current text. - Swiping back to the translated swipe shows its translation again. Nothing is deleted from the translation store. - One Unreleased changelog entry. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated checks run locally on `9c82932c0`: - Client `tsc --noEmit`, ESLint on `ChatMessage.tsx`, and Prettier on changed files: clean. The full `pnpm check` was not run locally because the maintainer asked for this urgently. CI `pnpm-validate` covers it. - Temporary Playwright proof, removed per repo policy, on desktop Chromium, mobile Chromium and mobile WebKit. It seeded a translation for the current swipe, regenerated with a held stream, and checked: - no old translation while streaming; - none on the saved new swipe; - the translation returns after swiping back. It passed 3/3 with the fix and failed without it ("no old translation during the stream"). - Existing `e2e/translation-only.e2e.ts` passed 9/9. - Local CodeRabbit review was skipped because of the maintainer's ASAP request. The hosted CodeRabbit check remains a merge gate. ### Manual verification notes - Manually verify on iPhone: translate a roleplay reply, regenerate it, and confirm only the new text streams, with no divider and no old translation. - Manually verify the new swipe has no translation afterward, and that swiping back to the old swipe shows its translation again. - Manually verify "Show translation only" still replaces the text with its translation when it matches. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Only `CHANGELOG.md` changes. There are no user-facing docs or release metadata changes. ## UI evidence (if applicable) Before the fix, the new stream shows on top, then a divider, then the old swipe's translation. The Playwright capture from mobile WebKit looks the same as the maintainer's iPhone screenshots. After the fix, only the stream is shown. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Translations are hidden while a reply is being regenerated and new text is streaming. * A regenerated reply no longer displays the previous swipe’s translation. Returning to the previous swipe still shows its translation. * Translations are shown only when they match the current message text, unless no source text was recorded. <!-- 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-23 04:18:50 +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#7345
No description provided.