[PR #49] [MERGED] perf(client): split chat area surfaces and lazy-load overlays #4419

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/49
Author: @TheLonelyDevil9
Created: 4/2/2026
Status: ✅ Merged
Merged: 4/2/2026
Merged by: @SpicyMarinara

Base: main ← Head: perf/lazy-chat-surfaces


📝 Commits (4)

  • 566aaba perf(client): split chat area surfaces
  • 4e8952e perf(client): defer optional roleplay modules
  • 7ebe7b1 perf(client): defer roleplay info panels
  • ceb0650 perf(client): defer conversation autonomous effects

📊 Changes

8 files changed (+2047 additions, -1319 deletions)

View changed files

📝 packages/client/src/components/chat/ChatArea.tsx (+193 -1222)
➕ packages/client/src/components/chat/ChatCommonOverlays.tsx (+211 -0)
➕ packages/client/src/components/chat/ChatConversationSurface.tsx (+187 -0)
➕ packages/client/src/components/chat/ChatRoleplayPanels.tsx (+162 -0)
➕ packages/client/src/components/chat/ChatRoleplaySurface.tsx (+1112 -0)
➕ packages/client/src/components/chat/ConversationAutonomousEffects.tsx (+116 -0)
📝 packages/client/src/components/chat/ConversationView.tsx (+21 -97)
➕ packages/client/src/components/chat/chat-area.types.ts (+45 -0)

📄 Description

Why This PR

  • This branch is the client bundle reduction checkpoint before deeper optimization work.
  • The changes are still behavior-preserving: they only restructure how chat code is loaded, so they are safest to review independently from later UI or data-flow changes.
  • Keeping these reductions grouped in one PR gives us a clear before/after measurement for the chat surface before targeting the next hotspot.

Summary

  • split ChatArea into lazy-loaded conversation and roleplay surfaces
  • move shared chat types and overlay wiring into dedicated modules
  • lazy-load chat drawers and prompt/setup modals so they only load when opened
  • lazy-load optional roleplay modules so they only load when actually needed:
    • RoleplayHUD
    • WeatherEffects
    • SpriteOverlay
    • SpriteSidebar
    • EncounterModal
    • SummaryPopover
    • EchoChamberPanel

Validation

  • corepack pnpm --filter @marinara-engine/client build
  • corepack pnpm check

Bundle Impact

  • old monolithic ChatArea chunk: 436.06 kB raw / 108.96 kB gzip
  • conversation live path (ChatArea + ChatConversationSurface + ChatCommonOverlays): 153.90 kB raw / 47.78 kB gzip
  • roleplay base live path (ChatArea + ChatRoleplaySurface + ChatCommonOverlays): 166.24 kB raw / 50.44 kB gzip
  • ChatRoleplaySurface dropped from 163.95 kB raw / 42.21 kB gzip to 65.42 kB raw / 18.05 kB gzip after deferring optional roleplay modules
  • ChatCommonOverlays dropped from 171.34 kB raw / 39.29 kB gzip to 49.05 kB raw / 15.59 kB gzip after deferring drawers and modals
  • ChatSettingsDrawer is now its own deferred chunk at 79.31 kB raw / 16.29 kB gzip
  • newly deferred roleplay chunks now load only on demand:
    • RoleplayHUD: 47.20 kB raw / 11.37 kB gzip
    • EncounterModal: 21.07 kB raw / 5.62 kB gzip
    • WeatherEffects: 14.73 kB raw / 4.29 kB gzip
    • SpriteOverlay: 6.92 kB raw / 2.96 kB gzip
    • SummaryPopover: 5.29 kB raw / 2.07 kB gzip
    • EchoChamberPanel: 4.98 kB raw / 2.17 kB gzip
    • SpriteSidebar: 1.81 kB raw / 1.01 kB gzip

Notes

  • PWA precache bytes are effectively flat to slightly higher because this work trades one large eager chunk for multiple deferred chunks. The win here is route parse/load cost, not install size.

Follow-up

  • next optimization target is ChatSettingsDrawer, then the remaining roleplay toolbar widgets (WorldInfoButton and AuthorNotesButton) if we want to keep reducing the roleplay-first-load path

🔄 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/49 **Author:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Created:** 4/2/2026 **Status:** ✅ Merged **Merged:** 4/2/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `perf/lazy-chat-surfaces` --- ### 📝 Commits (4) - [`566aaba`](https://github.com/Pasta-Devs/Marinara-Engine/commit/566aaba025a56d9a90cf1772bde29684685982af) perf(client): split chat area surfaces - [`4e8952e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4e8952ec837a2153cfdfde1914d17e5d2725e13b) perf(client): defer optional roleplay modules - [`7ebe7b1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7ebe7b10a46aa1efd48b9b715f37ac93d423fc68) perf(client): defer roleplay info panels - [`ceb0650`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ceb0650d9a51235d4b1a206137fc1b59c3e28bac) perf(client): defer conversation autonomous effects ### 📊 Changes **8 files changed** (+2047 additions, -1319 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatArea.tsx` (+193 -1222) ➕ `packages/client/src/components/chat/ChatCommonOverlays.tsx` (+211 -0) ➕ `packages/client/src/components/chat/ChatConversationSurface.tsx` (+187 -0) ➕ `packages/client/src/components/chat/ChatRoleplayPanels.tsx` (+162 -0) ➕ `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+1112 -0) ➕ `packages/client/src/components/chat/ConversationAutonomousEffects.tsx` (+116 -0) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+21 -97) ➕ `packages/client/src/components/chat/chat-area.types.ts` (+45 -0) </details> ### 📄 Description ## Why This PR - This branch is the client bundle reduction checkpoint before deeper optimization work. - The changes are still behavior-preserving: they only restructure how chat code is loaded, so they are safest to review independently from later UI or data-flow changes. - Keeping these reductions grouped in one PR gives us a clear before/after measurement for the chat surface before targeting the next hotspot. ## Summary - split `ChatArea` into lazy-loaded conversation and roleplay surfaces - move shared chat types and overlay wiring into dedicated modules - lazy-load chat drawers and prompt/setup modals so they only load when opened - lazy-load optional roleplay modules so they only load when actually needed: - `RoleplayHUD` - `WeatherEffects` - `SpriteOverlay` - `SpriteSidebar` - `EncounterModal` - `SummaryPopover` - `EchoChamberPanel` ## Validation - `corepack pnpm --filter @marinara-engine/client build` - `corepack pnpm check` ## Bundle Impact - old monolithic `ChatArea` chunk: `436.06 kB` raw / `108.96 kB` gzip - conversation live path (`ChatArea` + `ChatConversationSurface` + `ChatCommonOverlays`): `153.90 kB` raw / `47.78 kB` gzip - roleplay base live path (`ChatArea` + `ChatRoleplaySurface` + `ChatCommonOverlays`): `166.24 kB` raw / `50.44 kB` gzip - `ChatRoleplaySurface` dropped from `163.95 kB` raw / `42.21 kB` gzip to `65.42 kB` raw / `18.05 kB` gzip after deferring optional roleplay modules - `ChatCommonOverlays` dropped from `171.34 kB` raw / `39.29 kB` gzip to `49.05 kB` raw / `15.59 kB` gzip after deferring drawers and modals - `ChatSettingsDrawer` is now its own deferred chunk at `79.31 kB` raw / `16.29 kB` gzip - newly deferred roleplay chunks now load only on demand: - `RoleplayHUD`: `47.20 kB` raw / `11.37 kB` gzip - `EncounterModal`: `21.07 kB` raw / `5.62 kB` gzip - `WeatherEffects`: `14.73 kB` raw / `4.29 kB` gzip - `SpriteOverlay`: `6.92 kB` raw / `2.96 kB` gzip - `SummaryPopover`: `5.29 kB` raw / `2.07 kB` gzip - `EchoChamberPanel`: `4.98 kB` raw / `2.17 kB` gzip - `SpriteSidebar`: `1.81 kB` raw / `1.01 kB` gzip ## Notes - PWA precache bytes are effectively flat to slightly higher because this work trades one large eager chunk for multiple deferred chunks. The win here is route parse/load cost, not install size. ## Follow-up - next optimization target is `ChatSettingsDrawer`, then the remaining roleplay toolbar widgets (`WorldInfoButton` and `AuthorNotesButton`) if we want to keep reducing the roleplay-first-load path --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:07:26 +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#4419
No description provided.