[PR #6393] [MERGED] fix: open Conversation and Roleplay chats at the latest message #7163

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

📋 Pull Request Information

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

Base: staging ← Head: codex/chat-open-latest-message


📝 Commits (2)

  • 07f420a chore: begin chat opening regression fix for issue 6392
  • 411e6eb fix: keep chat openings anchored through late layout

📊 Changes

5 files changed (+232 additions, -19 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
➕ e2e/chat-open-bottom.e2e.ts (+154 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+24 -5)
📝 packages/client/src/components/chat/ConversationView.tsx (+11 -14)
➕ packages/client/src/hooks/use-chat-opening-scroll.ts (+41 -0)

📄 Description

Linked issue

Closes #6392.

Why this change

Opening Conversation and Roleplay chats must show the latest sent message on desktop and mobile, including reloads and switching chats. The initial scroll previously finished after two animation frames even if the transcript had no layout box yet or its content was still resizing. A controlled delayed-image reproduction left Conversation 3,209px and Roleplay 2,302px above the bottom on the staging baseline.

What changed

  • Reuse one small opening-scroll hook in both modes. Observe the existing viewport and message rows until reader input, chat navigation, or an explicit message jump takes over.
  • Wait for loaded message data, re-arm when returning from Home, and preserve the existing native selection, pagination and streaming controls.
  • Add a browser regression for delayed data/media/layout, reload, switching populated chats, and manual history scrolling; add the changelog entry. No dependencies or UI options added.

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 results: pnpm check passed, including localization, formatting, lint, TypeScript and production builds. Six opening tests passed in desktop Chromium, mobile Chromium and mobile WebKit. Eleven existing checks passed for native selection, searching unloaded history and mobile Load More. Eight more opening checks passed against the built production server in desktop Chromium/Firefox and mobile Chromium/WebKit. The unrelated existing GameNarration hook-dependency warning remains.

Local CodeRabbit reviewed all five files. Its trivial suggestion to add another observer and a fixed expiry was declined: opening rows are already mounted; later insertions use existing scrolling, and a timer would restore the late-layout deadline. The limited observation scope is documented in the hook.

Manual verification notes

  • Manually verify opening and reopening Conversation and Roleplay chats on a physical phone and desktop using your usual messages and preferences.
  • Manually verify loading older history and jumping to a message preserve the reading position.

The exact reporter environment was not available. Ordinary plain-text baseline checks passed; the failing reproduction exercises late layout changes. Mobile results above use Playwright device emulation. The new tests also cover a viewport becoming visible after mounting.

Docs and release impact

A user-facing [Unreleased] changelog entry is included. No documentation, translations or release version changes are needed.

UI evidence (if applicable)

Before/after screenshots, reproduction logs and review notes.

Summary by CodeRabbit

  • Bug Fixes
    • Conversation and Roleplay chats now open at the latest message while content, images, fonts, and layout finish loading.
    • The view remains positioned at the bottom after reloads and when reopening chats.
    • Manual scrolling through earlier messages is preserved and no longer pulls the view back to the latest message.
    • Jumping to a specific message now takes precedence over automatic opening-position behavior.

🔄 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/6393 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/19/2026 **Status:** ✅ Merged **Merged:** 9/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/chat-open-latest-message` --- ### 📝 Commits (2) - [`07f420a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/07f420a35bfbe540fb62b69e74b5c46a955591c0) chore: begin chat opening regression fix for issue 6392 - [`411e6eb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/411e6eba735fea2de139e113fd24eef9aa5f5903) fix: keep chat openings anchored through late layout ### 📊 Changes **5 files changed** (+232 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) ➕ `e2e/chat-open-bottom.e2e.ts` (+154 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+24 -5) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+11 -14) ➕ `packages/client/src/hooks/use-chat-opening-scroll.ts` (+41 -0) </details> ### 📄 Description ## Linked issue Closes #6392. ## Why this change Opening Conversation and Roleplay chats must show the latest sent message on desktop and mobile, including reloads and switching chats. The initial scroll previously finished after two animation frames even if the transcript had no layout box yet or its content was still resizing. A controlled delayed-image reproduction left Conversation 3,209px and Roleplay 2,302px above the bottom on the staging baseline. ## What changed - Reuse one small opening-scroll hook in both modes. Observe the existing viewport and message rows until reader input, chat navigation, or an explicit message jump takes over. - Wait for loaded message data, re-arm when returning from Home, and preserve the existing native selection, pagination and streaming controls. - Add a browser regression for delayed data/media/layout, reload, switching populated chats, and manual history scrolling; add the changelog entry. No dependencies or UI options added. ## 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 results: `pnpm check` passed, including localization, formatting, lint, TypeScript and production builds. Six opening tests passed in desktop Chromium, mobile Chromium and mobile WebKit. Eleven existing checks passed for native selection, searching unloaded history and mobile Load More. Eight more opening checks passed against the built production server in desktop Chromium/Firefox and mobile Chromium/WebKit. The unrelated existing GameNarration hook-dependency warning remains. Local CodeRabbit reviewed all five files. Its trivial suggestion to add another observer and a fixed expiry was declined: opening rows are already mounted; later insertions use existing scrolling, and a timer would restore the late-layout deadline. The limited observation scope is documented in the hook. ### Manual verification notes - [ ] Manually verify opening and reopening Conversation and Roleplay chats on a physical phone and desktop using your usual messages and preferences. - [ ] Manually verify loading older history and jumping to a message preserve the reading position. The exact reporter environment was not available. Ordinary plain-text baseline checks passed; the failing reproduction exercises late layout changes. Mobile results above use Playwright device emulation. The new tests also cover a viewport becoming visible after mounting. ## Docs and release impact A user-facing `[Unreleased]` changelog entry is included. No documentation, translations or release version changes are needed. ## UI evidence (if applicable) [Before/after screenshots, reproduction logs and review notes](https://gist.github.com/SpicyMarinara/c34053f3c3cc8166dcf2e9984092985a). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Conversation and Roleplay chats now open at the latest message while content, images, fonts, and layout finish loading. - The view remains positioned at the bottom after reloads and when reopening chats. - Manual scrolling through earlier messages is preserved and no longer pulls the view back to the latest message. - Jumping to a specific message now takes precedence over automatic opening-position behavior. <!-- 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:17:06 +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#7163
No description provided.