Conversation
…bled change Add RegistrationCodeEnabled to STATUS_RELATED_KEYS so saving the switch invalidates the ['status'] query and clears the localStorage copy. The sidebar Registration Codes entry is gated on status.registration_code_enabled and previously only appeared after a hard refresh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
📝 变更描述 / Description
开启「邀请码注册」(
RegistrationCodeEnabled)后,侧边栏的 Registration Codes 管理入口不会立即出现,必须硬刷新页面才能看到。原因:系统设置保存 hook(
web/src/features/system-settings/hooks/use-update-option.ts)中的STATUS_RELATED_KEYS白名单决定哪些配置项保存后需要失效['status']查询缓存并清除 localStorage 中的status副本。RegistrationCodeEnabled不在白名单内,保存后前端 status 缓存(React QuerystaleTime5 分钟 + localStorageplaceholderData)保留旧值,而侧边栏入口由status.registration_code_enabled门控(use-sidebar-data.ts),因此不刷新就不更新。修复:将
RegistrationCodeEnabled加入STATUS_RELATED_KEYS(与HeaderNavModules、SidebarModulesAdmin等同类前端显示相关 key 一致)。保存开关后立即重新拉取/api/status并更新 localStorage,侧边栏入口随保存即时出现/消失,无需刷新页面。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
改动为向既有字符串常量数组新增一项(+1 行),缓存失效行为由该白名单的既有机制保证(同列表其他 key 已验证的路径)。本地尚未运行前端构建验证;验证方式:构建后在系统设置中切换「邀请码注册」开关,侧边栏 Registration Codes 入口应随保存即时出现/消失,无需刷新。
🤖 Generated with Claude Code