Commit b0cf11b
fix(settings): add fault tolerance and robust defaults for corrupted config files (#346)
- Remove unused comment in ThemeCustomizer.tsx
- Fix Theme import in ThemePreview.tsx (use type-only import)
- Enhance loadSettings in SettingsContext.tsx:
- Validate loaded settings have required structure
- Deep merge with DEFAULT_SETTINGS for missing nested sections
- Fall back to default settings when loading fails (e.g., corrupted config)
- Add console error logging for debugging
These changes ensure the GUI remains functional even when config files
are corrupted or missing, preventing 'Cannot read properties of undefined'
errors.
Co-authored-by: Droid Agent <droid@factory.ai>1 parent 2077cd5 commit b0cf11b
3 files changed
Lines changed: 26 additions & 3 deletions
File tree
- cortex-gui/src
- components/settings
- context
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | | - | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1144 | 1144 | | |
1145 | 1145 | | |
1146 | 1146 | | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
1147 | 1168 | | |
1148 | | - | |
| 1169 | + | |
1149 | 1170 | | |
1150 | 1171 | | |
1151 | 1172 | | |
1152 | 1173 | | |
| 1174 | + | |
1153 | 1175 | | |
1154 | 1176 | | |
1155 | 1177 | | |
| 1178 | + | |
| 1179 | + | |
1156 | 1180 | | |
1157 | 1181 | | |
1158 | 1182 | | |
| |||
0 commit comments