mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 19:16:24 +00:00
feat: 更新默认站点名称以更清晰地反映错误状态,优化合并逻辑以支持对象递归合并
This commit is contained in:
@ -34,7 +34,7 @@ export type SiteInfo = {
|
||||
export const fallbackSiteInfo: SiteInfo = {
|
||||
colorSchemes: ["blue", "green", "orange", "red", "rose", "violet", "yellow"],
|
||||
metadata: {
|
||||
name: "Failed to Fetch Name",
|
||||
name: "Failed to Fetch",
|
||||
icon: "",
|
||||
description: "Failed to fetch site info from server.",
|
||||
},
|
||||
@ -87,8 +87,8 @@ function mergeWithFallback<T extends Record<string, unknown>>(initial: T, fallba
|
||||
typeof fallbackValue === 'object' &&
|
||||
!Array.isArray(fallbackValue)
|
||||
) {
|
||||
// 如果都是对象(非数组),也不要递归合并
|
||||
result[key] = { ...initialValue, ...fallbackValue };
|
||||
// 如果都是对象(非数组),递归合并
|
||||
result[key] = mergeWithFallback(initialValue as Record<string, unknown>, fallbackValue as Record<string, unknown>) as T[typeof key];
|
||||
}
|
||||
// 否则保持 initial 的值不变
|
||||
}
|
||||
|
Reference in New Issue
Block a user