Commit 7326aa2
baiqing
fix(vocab): 兼容 Swift dictionary.json 老 schema (notes/hitCount)
老 Swift 版 DictionaryEntry 写到 ~/Library/Application Support/OpenLess/dictionary.json 的
字段名是 `notes`(复数)和 `hitCount`,Rust 这边期待 `note`/`hits` → serde decode 失败 →
list_vocab 命令永远返回 Err → 前端 spinner 永久卡死。
修法:
- types.rs DictionaryEntry 加 #[serde(alias = "notes")] / #[serde(alias = "hitCount")] +
default,兼容老文件 + 新写入。
- Vocab.tsx refresh() 加 try/catch + finally,即使后端报错也清掉加载状态,显示错误提示。1 parent 4475a6d commit 7326aa2
2 files changed
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
| 64 | + | |
61 | 65 | | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
| 69 | + | |
| 70 | + | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
| 74 | + | |
| 75 | + | |
66 | 76 | | |
67 | 77 | | |
68 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
18 | 27 | | |
19 | 28 | | |
20 | 29 | | |
| |||
82 | 91 | | |
83 | 92 | | |
84 | 93 | | |
85 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
86 | 100 | | |
87 | 101 | | |
88 | 102 | | |
89 | 103 | | |
90 | | - | |
| 104 | + | |
91 | 105 | | |
92 | 106 | | |
93 | 107 | | |
| |||
0 commit comments