Skip to content

Fix missing space in import-cookies "From <browser>" menu labels#6468

Merged
Jinwoo-H merged 3 commits into
stablyai:mainfrom
TrentFisher6:fix/import-cookies-from-label-spacing
Jul 4, 2026
Merged

Fix missing space in import-cookies "From <browser>" menu labels#6468
Jinwoo-H merged 3 commits into
stablyai:mainfrom
TrentFisher6:fix/import-cookies-from-label-spacing

Conversation

@TrentFisher6

@TrentFisher6 TrentFisher6 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

In the browser settings Session & Cookies → Import Cookies dropdown, the per-browser entries rendered with no space between "From" and the browser name — e.g. FromGoogle Chrome and FromSafari. Only the browser entries were affected; From File… was correct because it is a single literal string.

Root cause: the label was built from two adjacent JSX expressions, {translate(…, 'From')}{browser.label}. JSX collapses the whitespace between sibling expressions, so the rendered text had no separator.

Fix

Switch both import menus to the interpolation pattern already used by the other two import-cookies menus in the app (browser-toolbar-menu-dropdown.tsx, BrowserImportHintButton.tsx):

translate(key, 'From {{value0}}', { value0: browser.label })

This keeps the label a single translatable unit and renders From Google Chrome with the correct space. Catalog keys were generated with the repo's own pnpm sync:localization-catalog. The new key is localized in es/ja/ko/zh to match the existing catalog style — and interpolation also fixes a latent word-order bug: ja/ko render "from" as a postposition (から / 에서) that belongs after the browser name, which the old 'From' + label concatenation placed before it.

Files changed:

  • src/renderer/src/components/settings/BrowserProfileRow.tsx — the menu in the screenshot (2 call sites)
  • src/renderer/src/components/settings/BrowserUseCookieImportStep.tsx — same latent bug (2 call sites)
  • src/renderer/src/i18n/locales/{en,es,ja,ko,zh}.json — new interpolated keys via the sync script

Tests

Added src/renderer/src/components/settings/browser-cookie-import-label.test.ts, which asserts the label keeps the space (From Google Chrome / From Safari) and that the catalog entry retains the {{value0}} placeholder, so the label can't silently regress to the concatenated form.

Verification

  • pnpm typecheck — clean
  • pnpm lint (incl. localization catalog + coverage) — clean; one pre-existing unrelated warning in src/renderer/src/components/right-sidebar/useGitStatusPolling.ts:161 (untouched file)
  • New regression test — passes
  • pnpm test — the cookie/settings/i18n tests pass. 25 failures in 7 unrelated sidebar test files (@vitest-environment happy-dom, window.localStorage undefined) reproduce identically on a clean tree with this change stashed, so they are pre-existing and unrelated — a local-toolchain artifact of running on Node 26 (repo pins Node 24).

Code review summary

  • Cross-platform: No platform-specific code; pure string/i18n change. Safe on macOS/Linux/Windows.
  • SSH / remote / local: No execution-context assumptions; renders identically everywhere.
  • Agents / integrations / git providers: None involved; this is browser-settings UI only.
  • Performance: Neutral — same number of translate calls, no new work in any hot path.
  • UI quality: Matches the existing import menus exactly; respects the design system (no new tokens/strings beyond the corrected label).
  • Security: No new inputs, IPC, or data flows; browser.label was already rendered.

Screenshots

Before:

image

After:

image

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 675cfd14-e893-4865-89c2-1054b8d6846d

📥 Commits

Reviewing files that changed from the base of the PR and between 30affd5 and 4887e14.

📒 Files selected for processing (7)
  • src/renderer/src/components/settings/BrowserUseCookieImportStep.tsx
  • src/renderer/src/components/settings/browser-cookie-import-label.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
✅ Files skipped from review due to trivial changes (1)
  • src/renderer/src/components/settings/BrowserUseCookieImportStep.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/renderer/src/components/settings/browser-cookie-import-label.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json

📝 Walkthrough

Walkthrough

Browser cookie import labels now use interpolated translation strings with value0 for browser names and source labels in both settings components. Locale files add or update matching From {{value0}} and Last imported from {{value0}} entries across supported languages. A new Vitest file checks translated output spacing and verifies the English catalog stores interpolation templates.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: correcting missing spacing in import-cookies browser labels.
Description check ✅ Passed The description covers summary, screenshots, testing, and review notes, but lacks explicit Security Audit and Notes sections.
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.

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.

The Import Cookies dropdown rendered browser entries as "FromGoogle Chrome"
and "FromSafari" — JSX collapses whitespace between the adjacent
{translate(…, 'From')}{browser.label} expressions.

Switch both settings menus to the 'From {{value0}}' interpolation pattern
already used by the other import-cookies menus, so the label is a single
translatable unit and renders with the correct space. Interpolation also lets
each locale position the browser name correctly: ja/ko use postpositions
("から"/"에서") that belong after the name, which the old concatenation placed
before it. Localized the new key in es/ja/ko/zh to match the existing catalog
style. Adds a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@TrentFisher6 TrentFisher6 force-pushed the fix/import-cookies-from-label-spacing branch from 09e11c4 to 30affd5 Compare June 27, 2026 03:32
@AmethystLiang AmethystLiang requested a review from Jinwoo-H June 27, 2026 16:49
Co-authored-by: Orca <help@stably.ai>

@Jinwoo-H Jinwoo-H left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the focused fix. I verified:

  • The affected settings import menus now render From Google Chrome / From Safari with correct spacing.
  • I added a maintainer follow-up for the Browser Use “Last imported from ” caption, which had the same adjacent JSX spacing issue.
  • Typecheck, lint/localization checks, targeted regression tests, and Electron validation all pass.

Co-authored-by: Orca <help@stably.ai>
@Jinwoo-H Jinwoo-H merged commit 8b69e41 into stablyai:main Jul 4, 2026
1 check passed
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.

2 participants