[PR #133] [MERGED] perf(client): split translation state from on-demand helpers #4479

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

📋 Pull Request Information

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

Base: main ← Head: codex/client-translation-loading-boundary


📝 Commits (1)

  • 112d3f0 perf(client): split translation state from on-demand helpers

📊 Changes

7 files changed (+82 additions, -79 deletions)

View changed files

📝 packages/client/src/components/chat/ChatArea.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatInput.tsx (+1 -1)
📝 packages/client/src/components/chat/ConversationInput.tsx (+2 -2)
📝 packages/client/src/hooks/use-generate.ts (+1 -1)
📝 packages/client/src/hooks/use-translate.ts (+1 -74)
➕ packages/client/src/lib/translate-text.ts (+16 -0)
➕ packages/client/src/stores/translation.store.ts (+60 -0)

📄 Description

Why

The client build currently emits a Vite warning because the translation module is imported both statically and dynamically. That prevents Vite from cleanly splitting the imperative input-translation path into its own async chunk and makes the loading boundary around translation behavior harder to reason about.

This PR is intentionally small and low-risk. It is the first slice in a broader optimization pass, and it only changes module boundaries around translation state and helper loading.

What Changed

  • moved translation Zustand state into a dedicated lightweight store module
  • kept the interactive message translation hook focused on UI usage
  • moved the imperative input-translation helper into its own tiny async module
  • updated chat input and conversation input to lazy-load only the imperative helper
  • updated generation cleanup and chat area code to import the lightweight store directly

Why This Shape

  • removes the current mixed static/dynamic import warning from the client build
  • preserves existing behavior while making the async translation path explicit
  • keeps the always-loaded translation state tiny and predictable
  • creates a cleaner foundation for later client bundle work without mixing in unrelated changes

Review Guidance

  1. Check that translation behavior is unchanged in message rendering and auto-translate flows.
  2. Check that input translation still works in both chat input components.
  3. Confirm the build no longer reports the previous mixed-import Vite warning.

Validation

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

Follow-ups

This is PR 1 of the optimization train. The next slices are planned as:

  • trim the large GameSurface chunk by lazy-loading secondary overlays
  • decompose the largest UI monoliths like ChatSettingsDrawer and SettingsPanel
  • extract the server generation pipeline into smaller route/domain modules
  • address bundled server asset weight and Docker/build-context cost separately

🔄 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/133 **Author:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Created:** 4/20/2026 **Status:** ✅ Merged **Merged:** 4/20/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `codex/client-translation-loading-boundary` --- ### 📝 Commits (1) - [`112d3f0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/112d3f03ed66f01c0fd1e79a6019c7c8915b5db9) perf(client): split translation state from on-demand helpers ### 📊 Changes **7 files changed** (+82 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatArea.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatInput.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+2 -2) 📝 `packages/client/src/hooks/use-generate.ts` (+1 -1) 📝 `packages/client/src/hooks/use-translate.ts` (+1 -74) ➕ `packages/client/src/lib/translate-text.ts` (+16 -0) ➕ `packages/client/src/stores/translation.store.ts` (+60 -0) </details> ### 📄 Description ## Why The client build currently emits a Vite warning because the translation module is imported both statically and dynamically. That prevents Vite from cleanly splitting the imperative input-translation path into its own async chunk and makes the loading boundary around translation behavior harder to reason about. This PR is intentionally small and low-risk. It is the first slice in a broader optimization pass, and it only changes module boundaries around translation state and helper loading. ## What Changed - moved translation Zustand state into a dedicated lightweight store module - kept the interactive message translation hook focused on UI usage - moved the imperative input-translation helper into its own tiny async module - updated chat input and conversation input to lazy-load only the imperative helper - updated generation cleanup and chat area code to import the lightweight store directly ## Why This Shape - removes the current mixed static/dynamic import warning from the client build - preserves existing behavior while making the async translation path explicit - keeps the always-loaded translation state tiny and predictable - creates a cleaner foundation for later client bundle work without mixing in unrelated changes ## Review Guidance 1. Check that translation behavior is unchanged in message rendering and auto-translate flows. 2. Check that input translation still works in both chat input components. 3. Confirm the build no longer reports the previous mixed-import Vite warning. ## Validation - pnpm --filter @marinara-engine/client build ## Follow-ups This is PR 1 of the optimization train. The next slices are planned as: - trim the large GameSurface chunk by lazy-loading secondary overlays - decompose the largest UI monoliths like ChatSettingsDrawer and SettingsPanel - extract the server generation pipeline into smaller route/domain modules - address bundled server asset weight and Docker/build-context cost separately --- <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:59 +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#4479
No description provided.