Repository navigation
fix(settings): avoid flashing the loading indicator when reopening settings - #9908
Merged
farion1231 merged 1 commit intoNov 23, 2026
Merged
Conversation
2 tasks done
Owner
|
已合并,感谢 @fuyundev!复现截图和 WKWebView 前后对比很有说服力,顺手把初始化和重置的规范化合成一份也让这块代码清爽了不少。 |
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.
Human Note / 本人说明
在 macOS 上使用 CC Switch 4.0.39 时,从「应用」进入「设置」,点击「返回」后再次进入。即使设置数据已经缓存,右侧仍会短暂显示加载图标,随后才出现「通用」表单。
Summary / 概述
从「应用」进入「设置」,返回后再进入,即使设置已经缓存在 React Query 中,仍会短暂显示加载图标。此前
useSettingsForm把表单初值设为null,直到首次渲染后的 effect 才填入缓存数据。现在首帧直接使用经过规范化的缓存设置初始化表单。缓存为空时仍显示加载提示,后续查询返回新数据时继续同步表单。初始化和重置共用同一套字段默认值、目录清理和语言规范化逻辑。
Related Issue / 关联 Issue
Fixes #9907
Screenshots / 截图
在 macOS 安装版 4.0.39 中再次进入「设置」时截取的两帧。左图中「通用」标题已经出现,正文只有加载图标,右图中表单才出现。
Checklist / 检查清单
pnpm typecheckpnpm format:checkpnpm test:unit(4,423 项通过,覆盖缓存命中的首次渲染和空缓存首次读取)pnpm build:renderer在隔离的 macOS WKWebView 中使用完整前端和模拟 Tauri IPC,重复「应用 → 设置 → 返回」6 次。修复前 6 次均将加载图标插入 DOM,修复后 6 次均直接显示表单。另用空缓存验证了首次打开仍显示加载提示,数据返回后正常显示表单。
本次改动仅涉及前端表单及其测试。实现与自动化验证使用了 Codex 辅助。