[PR #2009] [MERGED] Fix transcript scroll measurement thrash #5387

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2009
Author: @Promansis
Created: 6/3/2026
Status: ✅ Merged
Merged: 6/3/2026
Merged by: @Promansis

Base: refactor ← Head: fix/issue-2007-reflow


📝 Commits (1)

  • 76c83ef Fix transcript scroll measurement thrash

📊 Changes

6 files changed (+119 additions, -33 deletions)

View changed files

📝 src/features/catalog/characters/components/CharacterLibraryView.tsx (+26 -5)
📝 src/features/catalog/characters/components/CharactersListSection.tsx (+1 -0)
📝 src/features/modes/conversation/components/ConversationView.tsx (+27 -14)
📝 src/features/modes/roleplay/hooks/use-roleplay-transcript-scroll.ts (+27 -14)
📝 src/features/modes/shared/chat-ui/index.ts (+1 -0)
➕ src/features/modes/shared/chat-ui/lib/transcript-scroll-geometry.ts (+37 -0)

📄 Description

Linked issue

Closes #2007

Why this change

  • Transcript scroll and character list measurement paths still had synchronous geometry read/write patterns that could trigger forced reflow during transcript opening, load-more preservation, and virtualized character list measurement.

What changed

  • Added a shared transcript scroll geometry helper that centralizes scroll metrics reads and schedules scroll writes through requestAnimationFrame.
  • Updated conversation and roleplay transcript scroll handling to use the shared helper while preserving existing bottom-scroll and load-more behavior.
  • Enabled TanStack Virtual's rAF-backed ResizeObserver measurement for character library virtualizers.
  • Deferred the character library detail remeasure call through requestAnimationFrame.
  • Batched character library width observer updates and used ResizeObserver-provided box sizes before falling back to clientWidth.

Refactor impact

Primary owner:

shared mode UI, chat mode, roleplay mode, catalog characters

Impact areas reviewed:

  • Conversation transcript scroll tracking, initial bottom positioning, and load-more preservation.
  • Roleplay transcript scroll tracking, initial bottom positioning, goto/load-more preservation, and streaming auto-scroll.
  • Character library grid virtualization and compact character list virtualization.

Boundary notes:

  • Shared transcript scroll geometry is exported through src/features/modes/shared/chat-ui/index.ts.
  • No engine, shared API, Rust, storage, provider, or remote-runtime boundaries changed.

Pressure points touched:

  • Shared mode UI transcript scroll helper.
  • Conversation transcript surface.
  • Roleplay transcript scroll hook.
  • Character catalog virtualized list surfaces.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm typecheck passed.
  • pnpm check:architecture passed.
  • Focused static proof passed: transcript direct scroll writes are centralized in the scheduled helper, and both character virtualizers opt into rAF ResizeObserver measurement.
  • No browser performance trace was captured.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Internal performance-risk fix only; no new user-facing feature or discoverable workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • No screenshots or recordings; this is a timing/performance-risk fix with intended visual behavior unchanged.

🔄 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/2009 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/issue-2007-reflow` --- ### 📝 Commits (1) - [`76c83ef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/76c83ef42b8d690c6a396c414b83bbdc7066cbe5) Fix transcript scroll measurement thrash ### 📊 Changes **6 files changed** (+119 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `src/features/catalog/characters/components/CharacterLibraryView.tsx` (+26 -5) 📝 `src/features/catalog/characters/components/CharactersListSection.tsx` (+1 -0) 📝 `src/features/modes/conversation/components/ConversationView.tsx` (+27 -14) 📝 `src/features/modes/roleplay/hooks/use-roleplay-transcript-scroll.ts` (+27 -14) 📝 `src/features/modes/shared/chat-ui/index.ts` (+1 -0) ➕ `src/features/modes/shared/chat-ui/lib/transcript-scroll-geometry.ts` (+37 -0) </details> ### 📄 Description ## Linked issue Closes #2007 ## Why this change - Transcript scroll and character list measurement paths still had synchronous geometry read/write patterns that could trigger forced reflow during transcript opening, load-more preservation, and virtualized character list measurement. ## What changed - Added a shared transcript scroll geometry helper that centralizes scroll metrics reads and schedules scroll writes through `requestAnimationFrame`. - Updated conversation and roleplay transcript scroll handling to use the shared helper while preserving existing bottom-scroll and load-more behavior. - Enabled TanStack Virtual's rAF-backed ResizeObserver measurement for character library virtualizers. - Deferred the character library detail remeasure call through `requestAnimationFrame`. - Batched character library width observer updates and used ResizeObserver-provided box sizes before falling back to `clientWidth`. ## Refactor impact Primary owner: shared mode UI, chat mode, roleplay mode, catalog characters Impact areas reviewed: - Conversation transcript scroll tracking, initial bottom positioning, and load-more preservation. - Roleplay transcript scroll tracking, initial bottom positioning, goto/load-more preservation, and streaming auto-scroll. - Character library grid virtualization and compact character list virtualization. Boundary notes: - Shared transcript scroll geometry is exported through `src/features/modes/shared/chat-ui/index.ts`. - No engine, shared API, Rust, storage, provider, or remote-runtime boundaries changed. Pressure points touched: - Shared mode UI transcript scroll helper. - Conversation transcript surface. - Roleplay transcript scroll hook. - Character catalog virtualized list surfaces. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm typecheck` passed. - `pnpm check:architecture` passed. - Focused static proof passed: transcript direct scroll writes are centralized in the scheduled helper, and both character virtualizers opt into rAF ResizeObserver measurement. - No browser performance trace was captured. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Internal performance-risk fix only; no new user-facing feature or discoverable workflow. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence - No screenshots or recordings; this is a timing/performance-risk fix with intended visual behavior unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:15:51 +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#5387
No description provided.