Fix error when adding custom setting with no category (#2112)

Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
bymyself
2024-12-31 17:04:58 -07:00
committed by GitHub
parent 3189e310a8
commit f507142e6a
2 changed files with 71 additions and 4 deletions

View File

@@ -11,9 +11,8 @@ import { buildTree } from '@/utils/treeUtil'
export const getSettingInfo = (setting: SettingParams) => {
const parts = setting.category || setting.id.split('.')
return {
category: parts[0],
subCategory: parts[1],
name: parts.slice(2).join('.')
category: parts[0] ?? 'Other',
subCategory: parts[1] ?? 'Other'
}
}