Skip to content

fix: 修复三个问题:偏好配置项修改后重启不会生效;锁屏弹出框的按钮文字错误;右上角偏好设置按钮排序问题优化; - #7930

Merged
jinmao88 merged 4 commits into
vbenjs:mainfrom
panfuy:feature/panfu_preferences
May 20, 2026
Merged

jinmao88 merged 4 commits into
vbenjs:mainfrom
panfuy:feature/panfu_preferences

Conversation

@panfuy

@panfuy panfuy commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

修复三个问题:
1、修正偏好设置加载缓存的偏好设置并与初始配置合并的顺序
修改前:

const mergedPreference = merge(
      {},
      cachedPreferences, // 缓存中已有的配置项,修改代码后重启不会生效,因为merge只会合并为空的配置项
      this.initialPreferences,
    );

修改后:

const mergedPreference = merge(
      {},
      this.initialPreferences, // 初始化的配置优先级最高(merge合并规则:后者覆盖前者,若是前者有值则跳过)
      cachedPreferences,
    );

2、修正锁屏弹出框的按钮文字
修改前:
锁屏按钮文字问题
修改后:
锁屏按钮文字问题2

3、偏好设置按钮排序优化(取第三个占位的数字,若是第三个占位不是数字,则自动分配排序索引)

  1. 将右上角“主题切换、语言切换、时区切换”显示控制统一由“偏好设置”按钮管理(因为他们都是偏好设置中的功能)
  2. split插槽名称从中获取索引值时加入Number.isNaN的判断,解决插槽名称不带数字或者名字较长时无法排序的问题
  3. 用户下拉框排序优化:若是索引值超过1000时则固定在1000(适配用户按钮不在最后的场景)

Summary by CodeRabbit

  • Bug Fixes

    • Corrected lock screen button label in English and Chinese to display "Unlock" appropriately.
    • Fixed preference initialization merge behavior so stored preferences are applied consistently after load.
  • Refactor

    • Improved header layout slot ordering and distribution so header controls and custom slots render in a more predictable order.

Review Change Stack

@changeset-bot

changeset-bot Bot commented May 20, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d6451f9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b6067ad-3098-4f07-92b1-b03ca13688e2

📥 Commits

Reviewing files that changed from the base of the PR and between db20077 and d6451f9.

📒 Files selected for processing (1)
  • packages/@core/preferences/src/preferences.ts

📝 Walkthrough

Walkthrough

Reverses preference merge precedence in initPreferences, refactors header slot index partitioning and dynamic slot indexing (REFERENCE_VALUE→100), and updates lock-screen button text in English and Chinese locales.

Changes

Preferences, Header Layout, and Locale Updates

Layer / File(s) Summary
Preference merge precedence
packages/@core/preferences/src/preferences.ts
initPreferences now merges initialPreferences before cachedPreferences, reversing which source takes precedence when constructing mergedPreference.
Header slot layout refactoring
packages/effects/layouts/src/basic/header/header.vue
REFERENCE_VALUE increased from 50 to 100; rightSlots and leftSlots refactored to use typed slot descriptors, built-in control indices rebuilt under the new scheme, dynamic integration of header-left-*/header-right-* slots via numeric-suffix parsing or auto-assigned nextIndex, appending user-dropdown with a capped index, and sorting by index for deterministic ordering.
Lock screen button UI text
packages/locales/src/langs/en-US/ui.json, packages/locales/src/langs/zh-CN/ui.json
widgets.lockScreen.screenButton changed from a locking-state label to the unlock action ("Unlock" / "解锁").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • anncwb
  • mynetfan
  • vince292007

Poem

🐰 I hop through merges, swapping order neat,
I nudge the header slots to dance and meet,
From fifty to a hundred the indices climb,
"Locking" now whispers "Unlock" in time,
A little rabbit cheers the tidy rhyme.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description thoroughly explains all three bug fixes with code examples and screenshots, but lacks required template sections like 'Type of change' and 'Checklist'. Add 'Type of change' section (mark 'Bug fix' checkbox) and complete the 'Checklist' section to match the required template format.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title comprehensively summarizes all three main changes in the PR: preference configuration precedence fix, lock screen button text correction, and header button sorting optimization.
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.

✏️ 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.

@panfuy panfuy changed the title 修复三个问题:偏好配置项修改后重启不会生效;锁屏弹出框的按钮文字错误;右上角偏好设置按钮排序问题优化; fix: 修复三个问题:偏好配置项修改后重启不会生效;锁屏弹出框的按钮文字错误;右上角偏好设置按钮排序问题优化; May 20, 2026

@coderabbitai coderabbitai Bot 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.

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/`@core/preferences/src/preferences.ts:
- Around line 127-139: The comments around the merge calls are inverted relative
to actual behavior: update the comment for the call that sets
this.initialPreferences (merge({}, overrides, defaultPreferences)) to state that
overrides take precedence over defaultPreferences, and update the comment for
the merge into mergedPreference (merge({}, this.initialPreferences,
cachedPreferences)) to state that this.initialPreferences takes precedence over
cachedPreferences; in short, clarify that in these merge(...) calls the later
argument wins and explicitly mention overrides > defaultPreferences and
initialPreferences > cachedPreferences so the precedence is unambiguous.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: d277570b-3921-46da-b3e7-cb22cd8d8174

📥 Commits

Reviewing files that changed from the base of the PR and between a4dd9d3 and db20077.

📒 Files selected for processing (4)
  • packages/@core/preferences/src/preferences.ts
  • packages/effects/layouts/src/basic/header/header.vue
  • packages/locales/src/langs/en-US/ui.json
  • packages/locales/src/langs/zh-CN/ui.json

@jinmao88
jinmao88 merged commit 769c970 into vbenjs:main May 20, 2026
14 checks passed
@doraemonxxx

Copy link
Copy Markdown
Contributor

This produces a bug about the preferences. Thankfully its already solved

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants