@@ -14,6 +14,7 @@ import {
1414 SettingsAlert ,
1515 SettingsField ,
1616 SettingsLoading ,
17+ SettingsPanelErrorBoundary ,
1718 SettingsSectionCard ,
1819} from '../components/settings' ;
1920import { WEB_BUILD_INFO } from '../utils/constants' ;
@@ -495,6 +496,31 @@ const SettingsPage: React.FC = () => {
495496 } ;
496497
497498 const desktopUpdateNotice = getDesktopUpdateNotice ( desktopUpdateState ) ;
499+ const shouldGuardActiveConfigPanel = activeCategory === 'notification' || activeCategory === 'agent' ;
500+ const activeConfigPanelErrorTitle = activeCategory === 'agent' ? 'Agent 设置' : '通知设置' ;
501+ const activeConfigPanel = activeItems . length ? (
502+ < SettingsSectionCard
503+ title = "当前分类配置项"
504+ description = { getCategoryDescriptionZh ( activeCategory as SystemConfigCategory , '' ) || '使用统一字段卡片维护当前分类的系统配置。' }
505+ >
506+ { activeItems . map ( ( item ) => (
507+ < SettingsField
508+ key = { item . key }
509+ item = { item }
510+ value = { item . value }
511+ disabled = { isSaving }
512+ onChange = { setDraftValue }
513+ issues = { issueByKey [ item . key ] || [ ] }
514+ />
515+ ) ) }
516+ </ SettingsSectionCard >
517+ ) : (
518+ < EmptyState
519+ title = "当前分类下暂无配置项"
520+ description = "当前分类没有可编辑字段;可切换左侧分类继续查看其它系统配置。"
521+ className = "settings-surface-panel settings-border-strong border-none bg-transparent shadow-none"
522+ />
523+ ) ;
498524
499525 return (
500526 < div className = "settings-page min-h-full px-4 pb-6 pt-4 md:px-6" >
@@ -754,35 +780,25 @@ const SettingsPage: React.FC = () => {
754780 < ChangePasswordCard />
755781 ) : null }
756782 { activeCategory === 'notification' ? (
757- < NotificationTestPanel
758- items = { rawActiveItems . map ( ( item ) => ( { key : item . key , value : String ( item . value ?? '' ) } ) ) }
759- maskToken = { maskToken }
760- disabled = { isSaving || isLoading }
761- />
783+ < SettingsPanelErrorBoundary
784+ title = "通知测试"
785+ resetKey = { `notification-test:${ configVersion } ` }
786+ >
787+ < NotificationTestPanel
788+ items = { rawActiveItems . map ( ( item ) => ( { key : item . key , value : String ( item . value ?? '' ) } ) ) }
789+ maskToken = { maskToken }
790+ disabled = { isSaving || isLoading }
791+ />
792+ </ SettingsPanelErrorBoundary >
762793 ) : null }
763- { activeItems . length ? (
764- < SettingsSectionCard
765- title = "当前分类配置项"
766- description = { getCategoryDescriptionZh ( activeCategory as SystemConfigCategory , '' ) || '使用统一字段卡片维护当前分类的系统配置。' }
794+ { shouldGuardActiveConfigPanel && activeItems . length ? (
795+ < SettingsPanelErrorBoundary
796+ title = { activeConfigPanelErrorTitle }
797+ resetKey = { ` ${ activeCategory } : ${ configVersion } ` }
767798 >
768- { activeItems . map ( ( item ) => (
769- < SettingsField
770- key = { item . key }
771- item = { item }
772- value = { item . value }
773- disabled = { isSaving }
774- onChange = { setDraftValue }
775- issues = { issueByKey [ item . key ] || [ ] }
776- />
777- ) ) }
778- </ SettingsSectionCard >
779- ) : (
780- < EmptyState
781- title = "当前分类下暂无配置项"
782- description = "当前分类没有可编辑字段;可切换左侧分类继续查看其它系统配置。"
783- className = "settings-surface-panel settings-border-strong border-none bg-transparent shadow-none"
784- />
785- ) }
799+ { activeConfigPanel }
800+ </ SettingsPanelErrorBoundary >
801+ ) : activeConfigPanel }
786802 </ section >
787803 </ div >
788804 ) }
0 commit comments