Home

dev / openkara

publicthedavidweng/OpenKaraΒ· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(app): split locale JSON and YouTube native surface from the main bundle

merged
Stack 2/2
#459 opened by devcursor/code-split-bundle-27b8β†’feat/418-online-sources
Conversation3
devopened this pull requestAuthorΒ· last week
Commits
0
Files changed…

Summary

Vite reported a 1.4 MB index-*.js chunk and three INEFFECTIVE_DYNAMIC_IMPORT warnings. Non-English locales were eagerly embedded, and YouTube playback dynamically imported Tauri APIs that the startup path already loads statically, so those import() calls never became real chunks.

This change lazy-loads non-English locale JSON through i18next.changeLanguage, and isolates the YouTube watch native surface in a module that is imported only when YouTube actually plays. PlaybackStage uses the same static Tauri emit / getCurrentWindow path as the rest of startup.

Changes

  • Bundle English only at startup; other locale JSON files load on demand.
  • Move createDefaultYoutubeWatchNativeSurface to src/playback/youtube-watch-native.ts and load it from the YouTube transport.
  • Keep YouTube host bounds reporting on the existing static Tauri window/event APIs.

Acceptance criteria

  • Vite production build emits no INEFFECTIVE_DYNAMIC_IMPORT warnings.
  • The main index-*.js chunk stays under the 1000 kB warning limit.
  • Switching to a non-English app language still loads that locale’s strings and updates document.documentElement.lang.
  • YouTube watch host creation still goes through the native surface; jsdom tests keep working without a live Tauri runtime.

Test plan

  • node --run lint and node --run build β€” local pre-push lint passed; production build emitted index at 871.23 kB gzip 248.74 kB, a youtube-watch-native chunk, per-locale chunks, and no Vite warnings
  • pnpm vitest run β€” 220 files / 2417 tests passed; patch coverage 82.6%
  • cd src-tauri && cargo clippy --all-targets -- -D warnings β€” skipped, no Rust changes
  • cd src-tauri && cargo nextest run β€” skipped, no Rust changes
  • node --run check:i18n β€” skipped, no UI copy added; locale JSON files are unchanged
  • docs/references/contracts/*.md updated β€” not required; no public IPC command, payload, or event change
  • Product-standard profiles: Language, terminology, and data (BCP-47 tags and document.lang unchanged; on-demand locale load covered in src/lib/i18n.test.ts) and Lifecycle, quality, and testing (chunk-size / ineffective-dynamic-import acceptance above). PlaybackStage still reports YouTube host bounds; no keyboard or widget contract change.

Residual risk

First switch to a non-English language now waits on a locale JSON chunk. Startup still hydrates settings through the existing await changeLanguage(...) path, so the English fallback window is the same as before plus that chunk fetch.

Related issues

Stacked on #419 (feat/418-online-sources). No separate issue.

Open in WebΒ Open in CursorΒ 
coderabbitai[bot]commentedΒ· last week

[!IMPORTANT]

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the [@coderabbitai](/coderabbitai) review command.

βš™οΈ Run configuration

Configuration used: Repository: thedavidweng/OpenKara/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 83c7debb-daa6-4fc5-8f25-fd739d4fc638

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • πŸ” Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment [@coderabbitai](/coderabbitai) help to get the list of available commands.

github-actions[bot]commentedΒ· last week

Coverage Report

Status Category Percentage Covered / Total
🟒 Lines 84.7% (🎯 65%) 8160 / 9633
🟒 Statements 83.9% (🎯 65%) 8653 / 10313
🟒 Functions 80.23% (🎯 60%) 2058 / 2565
🟒 Branches 76.6% (🎯 60%) 4634 / 6049
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/Playback/PlaybackStage.tsx 92.98% 88.46% 88.88% 92% 88, 98, 112-113
src/lib/i18n.ts 88% 100% 75% 87.5% 14-15, 48
src/playback/youtube-transport.ts 86.51% 81.48% 81.57% 90.24% 93-94, 95, 96, 111-116, 148
src/playback/youtube-watch-host.ts 81.51% 71.42% 81.48% 81.35% 46, 53, 56, 61, 105-108, 131, 135, 153, 211-217, 227, 256, 277, 282-284, 317
src/playback/youtube-watch-native.ts 100% 87.5% 100% 100%
Generated in workflow #1876 for commit 67cd711 by the Vitest Coverage Report Action
codecov[bot]commentedΒ· last week

Codecov Report

:x: Patch coverage is 95.65217% with 3 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 88.6%. Comparing base (982f350) to head (67cd711). :white_check_mark: All tests successful. No failed tests found.

Files with missing linesPatch %Lines
src/lib/i18n.ts89.4%2 Missing :warning:
src/components/Playback/PlaybackStage.tsx75.0%1 Missing :warning:
Additional details and impacted files
@@                    Coverage Diff                    @@
##           feat/418-online-sources    #459     +/-   ##
=========================================================
+ Coverage                     88.3%   88.6%   +0.2%
=========================================================
  Files                          219     220      +1
  Lines                        11686   11697     +11
  Branches                      3598    3531     -67
=========================================================
+ Hits                         10329   10365     +36
+ Misses                        1304    1279     -25
  Partials                        53      53
FlagCoverage Ξ”
frontend88.6% <95.6%> (+0.2%):arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

ComponentsCoverage Ξ”
frontend88.6% <95.6%> (+0.2%):arrow_up:
rustβˆ… <ΓΈ> (βˆ…)
Files with missing linesCoverage Ξ”
src/playback/youtube-transport.ts92.3% <100.0%> (+19.0%):arrow_up:
src/playback/youtube-watch-host.ts81.5% <ΓΈ> (+0.7%):arrow_up:
src/playback/youtube-watch-native.ts100.0% <100.0%> (ΓΈ)
src/components/Playback/PlaybackStage.tsx90.5% <75.0%> (-0.3%):arrow_down:
src/lib/i18n.ts92.5% <89.4%> (-7.5%):arrow_down:

... and 1 file with indirect coverage changes

:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign in to comment.

Stack

2/2
1

Merge readiness

Checking mergeability after the indexing worker computes the current branch state.

Autopilot

Debug

Reviews

Approved0
ReviewersNone yet

Configure an OpenRouter key in repository settings.

feat(catalog): add Online Sources for NetEase import and YouTube queue

#419 main ← feat/418-online-sources

Updated last month

open
2

fix(app): split locale JSON and YouTube native surface from the main bundle

#459 feat/418-online-sources ← cursor/code-split-bundle-27b8

Updated last week

merged