Skip to content

fix: update guide panel immediately after language switch#14758

Closed
HanaB14 wants to merge 1 commit intotoeverything:canaryfrom
HanaB14:fix-guide-language-refresh
Closed

fix: update guide panel immediately after language switch#14758
HanaB14 wants to merge 1 commit intotoeverything:canaryfrom
HanaB14:fix-guide-language-refresh

Conversation

@HanaB14
Copy link
Copy Markdown

@HanaB14 HanaB14 commented Mar 31, 2026

Summary

Fixes the issue where the left guide panel does not update immediately after switching display language.

Changes

  • removed stale memoized options in appearance settings
  • updated the guide panel and settings sections to re-render on language switch
  • cleaned unused React imports

Testing

  • switched between English and Chinese locally
  • confirmed the left guide panel updates immediately
  • confirmed theme and open-in-app options also update correctly
  • verified no page refresh is needed
  • tested switching back to English

Demo

Attached a short before/after video showing the fix.

After.mov
Before.mov

Closes #13291

Summary by CodeRabbit

  • Refactor
    • Simplified internal code structure in appearance, general, and workspace settings dialogs for improved maintainability.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

Four settings components have useMemo removed from their computed values, causing these values to recalculate on every render instead of being cached. This ensures they reflect the latest translation function state, addressing language-switch visibility issues in the Settings dialog.

Changes

Cohort / File(s) Summary
Settings Dialog Memoization Removal
packages/frontend/core/src/desktop/dialogs/setting/general-setting/appearance/index.tsx, packages/frontend/core/src/desktop/dialogs/setting/general-setting/appearance/links.tsx, packages/frontend/core/src/desktop/dialogs/setting/general-setting/index.tsx, packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/index.tsx
Removed useMemo wrappers and hooks from computed values (radioItems, options, settings, sidebar items) to ensure recalculation on every render, enabling translation updates to propagate correctly when language changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Hop, hop, the cache we shed,
Let translations dance instead,
Each render fresh, no memory held,
The words in every language spelled!
Settings bloom in every tongue, 🌍

🚥 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 describes the main fix: removing stale memoized dependencies to enable immediate guide panel updates after language switching.
Linked Issues check ✅ Passed All code changes directly address issue #13291 by removing useMemo wrappers from language-dependent UI options, enabling immediate re-renders on language changes.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the language switch issue—removing memoization from language-dependent settings to trigger immediate UI updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/frontend/core/src/desktop/dialogs/setting/general-setting/index.tsx (1)

65-150: Memoize useGeneralSettingList() and useWorkspaceSettingList() return values to stabilize sidebar memoization.

Both hooks currently return fresh arrays on every render, which invalidates the groups useMemo in setting-sidebar/index.tsx (lines 184–202) despite it depending on these lists. Wrapping each array with useMemo would preserve their identity across renders when dependencies haven't changed, allowing the groups memo to be effective and avoid unnecessary remapping work.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/frontend/core/src/desktop/dialogs/setting/general-setting/index.tsx`
around lines 65 - 150, The hook useGeneralSettingList (and similarly
useWorkspaceSettingList) returns a new array on every render which breaks the
groups memo in setting-sidebar/index.tsx; wrap the returned settings array in
React.useMemo so it only recreates when its real dependencies change (e.g.,
loggedIn, enableEditorSettings, environment, BUILD_CONFIG, hasPaymentFeature,
meetingSettings, t) and return that memoized array from
useGeneralSettingList/useWorkspaceSettingList to stabilize identity and allow
groups useMemo to work properly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@packages/frontend/core/src/desktop/dialogs/setting/general-setting/index.tsx`:
- Around line 65-150: The hook useGeneralSettingList (and similarly
useWorkspaceSettingList) returns a new array on every render which breaks the
groups memo in setting-sidebar/index.tsx; wrap the returned settings array in
React.useMemo so it only recreates when its real dependencies change (e.g.,
loggedIn, enableEditorSettings, environment, BUILD_CONFIG, hasPaymentFeature,
meetingSettings, t) and return that memoized array from
useGeneralSettingList/useWorkspaceSettingList to stabilize identity and allow
groups useMemo to work properly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0048b65-5014-4344-966f-e479c69998a4

📥 Commits

Reviewing files that changed from the base of the PR and between 91ad783 and ed9747d.

📒 Files selected for processing (4)
  • packages/frontend/core/src/desktop/dialogs/setting/general-setting/appearance/index.tsx
  • packages/frontend/core/src/desktop/dialogs/setting/general-setting/appearance/links.tsx
  • packages/frontend/core/src/desktop/dialogs/setting/general-setting/index.tsx
  • packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/index.tsx

@darkskygit
Copy link
Copy Markdown
Member

reolaced by #14760

@darkskygit darkskygit closed this Apr 1, 2026
darkskygit added a commit that referenced this pull request Apr 2, 2026
replace #14758


#### PR Dependency Tree


* **PR #14760** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Enhanced language switching to ensure the settings dialog properly
reflects language changes when users update their language preference.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Bug]: Language switch not applied on the Settings dialog

2 participants