mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-30 18:33:04 +08:00
fix(config): resolve common config sync issues across frontend and backend
- Fix backfill pollution: extract custom config from live when common config enabled - Fix proxy backup: merge common config before backup to preserve full config - Unify null override semantics: null no longer overrides in both frontend and backend - Add missing i18n keys for common config UI - Hide format button in readonly JsonEditor - Add mapGeminiWarningToI18n for user-friendly warning messages
This commit is contained in:
@@ -73,7 +73,7 @@ export const deepEqual = (a: unknown, b: unknown): boolean => {
|
||||
* - 嵌套对象:递归合并
|
||||
* - 数组:source 完全替换 target(不做元素级合并)
|
||||
* - 原始值:source 覆盖 target
|
||||
* - undefined:不覆盖
|
||||
* - undefined/null:不覆盖(与后端 config_merge.rs 保持一致)
|
||||
*/
|
||||
export const deepMerge = <T extends Record<string, unknown>>(
|
||||
target: T,
|
||||
@@ -85,8 +85,8 @@ export const deepMerge = <T extends Record<string, unknown>>(
|
||||
const sourceValue = source[key];
|
||||
const targetValue = result[key];
|
||||
|
||||
// undefined 不覆盖
|
||||
if (sourceValue === undefined) {
|
||||
// undefined 和 null 都不覆盖(与后端保持一致)
|
||||
if (sourceValue === undefined || sourceValue === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user