Skip to content

ui-next: inject i18n, code-langs & version#1193

Open
renbaoshuo wants to merge 1 commit into
hydro-dev:masterfrom
renbaoshuo:ui-next/inject-scripts
Open

ui-next: inject i18n, code-langs & version#1193
renbaoshuo wants to merge 1 commit into
hydro-dev:masterfrom
renbaoshuo:ui-next/inject-scripts

Conversation

@renbaoshuo

@renbaoshuo renbaoshuo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Improvements
    • Improved development previews with refreshed UI assets and more reliable hot reload behavior.
    • Updated localization, code-language, and version data more consistently during development and system updates.
    • Improved production asset loading to provide a fallback when versioned assets are unavailable.
    • Unified application build updates for more consistent renderer behavior across development and production environments.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

packages/ui-next now builds i18n, code-language, and version JavaScript assets in memory, optionally deriving addon hashes with simple-git. Development and production renderer injection use shared script helpers with cache-busted or hashed URLs. Startup, watch, i18n, and system-setting events now trigger the appropriate unified or targeted build operations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • hydro-dev/Hydro#1159: Both changes update UI renderer injection and build-related wiring in packages/ui-next/index.ts.

Suggested reviewers: undefined-moe, undefined-moe

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: ui-next now injects i18n, code languages, and version assets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
packages/ui-next/package.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ui-next/index.ts`:
- Around line 135-142: Update fetchAddonVersion to request only the latest
commit by passing maxCount: 1 to git.log(), while preserving the existing hash
and dirty-status version construction.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 87cdd953-0823-41d1-a33b-17d49ec75b5b

📥 Commits

Reviewing files that changed from the base of the PR and between f9cd5bc and 854d7b6.

📒 Files selected for processing (2)
  • packages/ui-next/index.ts
  • packages/ui-next/package.json

Comment thread packages/ui-next/index.ts
Comment on lines +135 to +142
const fetchAddonVersion = async (name: string, addonPath: string) => {
try {
const git = simpleGit(addonPath);
const [log, status] = await Promise.all([git.log(), git.status()]);
if (log.all.length > 0) {
let hash = log.all[0].hash.substring(0, 7);
if (!status.isClean()) hash += '-dirty';
versions[name] = versions[name] ? `${versions[name]}-${hash}` : hash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the target file and nearby context
git ls-files packages/ui-next/index.ts packages/ui-next/package.json package.json
wc -l packages/ui-next/index.ts
sed -n '110,170p' packages/ui-next/index.ts

# Find simple-git usage/version in the repo
rg -n "simple-git|git\.log\(" packages/ui-next package.json packages -g '!**/dist/**' -g '!**/build/**'

Repository: hydro-dev/Hydro

Length of output: 3811


🌐 Web query:

simple-git log maxCount option documentation

💡 Result:

In the simple-git library, the maxCount option within the git log method is used to limit the number of commits returned [1][2]. Specifying options.maxCount is functionally equivalent to passing the --max-count option directly to the underlying git log command [3][4]. You can use it by passing an options object to the log method, for example: git.log({ maxCount: 10 }); This configuration will instruct simple-git to retrieve only the most recent 10 commits [1][2]. The log method also supports various other options, including from and to for defining commit ranges, file for filtering by path, and custom formatting options [1][4].

Citations:


Bound the git log query to one commit. git.log() reads the full history for each addon, but only the latest hash is used here. Use maxCount: 1 to avoid unnecessary startup and rebuild work.

Proposed fix
-                const [log, status] = await Promise.all([git.log(), git.status()]);
+                const [log, status] = await Promise.all([git.log({ maxCount: 1 }), git.status()]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const fetchAddonVersion = async (name: string, addonPath: string) => {
try {
const git = simpleGit(addonPath);
const [log, status] = await Promise.all([git.log(), git.status()]);
if (log.all.length > 0) {
let hash = log.all[0].hash.substring(0, 7);
if (!status.isClean()) hash += '-dirty';
versions[name] = versions[name] ? `${versions[name]}-${hash}` : hash;
const fetchAddonVersion = async (name: string, addonPath: string) => {
try {
const git = simpleGit(addonPath);
const [log, status] = await Promise.all([git.log({ maxCount: 1 }), git.status()]);
if (log.all.length > 0) {
let hash = log.all[0].hash.substring(0, 7);
if (!status.isClean()) hash += '-dirty';
versions[name] = versions[name] ? `${versions[name]}-${hash}` : hash;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui-next/index.ts` around lines 135 - 142, Update fetchAddonVersion
to request only the latest commit by passing maxCount: 1 to git.log(), while
preserving the existing hash and dirty-status version construction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant