[PR #8031] [MERGED] perf(game): format Session Log text once and open long logs on their newest page #8062

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8031
Author: @kolacheee
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @kolacheee

Base: staging ← Head: claude/project-thread-23tuwp


📝 Commits (4)

  • be2f0ce perf(game): format Session Log text once and open long logs on their newest page
  • 11bd0d4 Merge staging
  • 32333e3 fix(game): clear cached narration HTML when the language or a translation changes
  • d3e8864 docs(game): name what cached narration HTML depends on

📊 Changes

5 files changed (+175 additions, -25 deletions)

View changed files

➕ e2e/game-log-page.e2e.ts (+73 -0)
📝 packages/client/src/components/game/GameNarration.tsx (+24 -25)
➕ packages/client/src/components/game/narration-html-cache.ts (+31 -0)
➕ scripts/regressions/game-narration-html-cache.regression.ts (+46 -0)
📝 scripts/regressions/tsconfig.client-lanes.json (+1 -0)

📄 Description

Linked issue

Closes #8030

Why this change

  • In long games, the Session Log lags on phones when it opens, closes, or jumps to a line. Every visible entry was formatted and sanitized again on each render of the narration panel. With Messages per page at 0 (load all), the log also built every entry of the game as soon as it opened.

What changed

  • The Game Session Log opens faster: each line's formatted text is prepared once and reused instead of rebuilt on every redraw.
  • With Messages per page at 0, the Session Log now opens on its newest 20 entries. Older, All and scrolling up still load the rest.

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

Manual verification notes

  • Timed a production build with a 250-message game (3 characters with sprites) on a Pixel 7 viewport at 4x CPU throttle, using Event Timing for each tap. Opening the Session Log at the default page size went from a median of 464 ms to 344 ms. With Messages per page at 0 it took 5 to 10 s before this change; it now opens the same 20-entry page as the default.
  • New e2e/game-log-page.e2e.ts: a 30-turn game with Messages per page at 0 opens its log on "Showing 20 of 30", and All shows every turn. It fails on staging and passes with this change on mobile-chromium and desktop-chromium.
  • e2e/game-log-overflow.e2e.ts, game-native-dice, game-one-request-dice, game-turn-macros and game-verb-only-turn pass on desktop-chromium. game-widget-style times out in this container on plain staging as well.
  • Client tsc --noEmit, ESLint and Prettier are clean on the changed files.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

UI evidence (if applicable)

  • No visual change: the log looks the same and only opens on a shorter page when Messages per page is 0.

🔄 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/8031 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `claude/project-thread-23tuwp` --- ### 📝 Commits (4) - [`be2f0ce`](https://github.com/Pasta-Devs/Marinara-Engine/commit/be2f0ce975a1762ef923184a8a87d1fe3f2baca3) perf(game): format Session Log text once and open long logs on their newest page - [`11bd0d4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/11bd0d453d9da6f33b3ed6c856e2ad8acef25d2a) Merge staging - [`32333e3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/32333e3dda602ed6df1b7e82184575d60750b855) fix(game): clear cached narration HTML when the language or a translation changes - [`d3e8864`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d3e8864f6b126d3ced3a2fdf5ae0e25825b84eae) docs(game): name what cached narration HTML depends on ### 📊 Changes **5 files changed** (+175 additions, -25 deletions) <details> <summary>View changed files</summary> ➕ `e2e/game-log-page.e2e.ts` (+73 -0) 📝 `packages/client/src/components/game/GameNarration.tsx` (+24 -25) ➕ `packages/client/src/components/game/narration-html-cache.ts` (+31 -0) ➕ `scripts/regressions/game-narration-html-cache.regression.ts` (+46 -0) 📝 `scripts/regressions/tsconfig.client-lanes.json` (+1 -0) </details> ### 📄 Description ## Linked issue Closes #8030 ## Why this change - In long games, the Session Log lags on phones when it opens, closes, or jumps to a line. Every visible entry was formatted and sanitized again on each render of the narration panel. With Messages per page at 0 (load all), the log also built every entry of the game as soon as it opened. ## What changed - The Game Session Log opens faster: each line's formatted text is prepared once and reused instead of rebuilt on every redraw. - With Messages per page at 0, the Session Log now opens on its newest 20 entries. Older, All and scrolling up still load the rest. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Timed a production build with a 250-message game (3 characters with sprites) on a Pixel 7 viewport at 4x CPU throttle, using Event Timing for each tap. Opening the Session Log at the default page size went from a median of 464 ms to 344 ms. With Messages per page at 0 it took 5 to 10 s before this change; it now opens the same 20-entry page as the default. - New `e2e/game-log-page.e2e.ts`: a 30-turn game with Messages per page at 0 opens its log on "Showing 20 of 30", and All shows every turn. It fails on staging and passes with this change on mobile-chromium and desktop-chromium. - `e2e/game-log-overflow.e2e.ts`, `game-native-dice`, `game-one-request-dice`, `game-turn-macros` and `game-verb-only-turn` pass on desktop-chromium. `game-widget-style` times out in this container on plain staging as well. - Client `tsc --noEmit`, ESLint and Prettier are clean on the changed files. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) ## UI evidence (if applicable) - No visual change: the log looks the same and only opens on a shorter page when Messages per page is 0. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:10:04 +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#8062
No description provided.