2
0
Эх сурвалжийг харах

fix(selectors): 修复平台/公司/渠道下拉框重置后未恢复默认值

问题:订单管理页面点击重置按钮后,平台/公司/渠道下拉框仍显示之前选择的值

原因:Select 组件在 value 为 undefined 时无法正确识别"未选择"状态

修复方案:
- PlatformSelector: value 使用 value?.toString() || ''
- CompanySelector: value 使用 value?.toString() || ''
- ChannelSelector: value 使用 value?.toString() || ''
- onValueChange 改为只在 val 存在时调用 onChange 回调

相关 Epic: Epic 15 Story 15.2

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 6 өдөр өмнө
parent
commit
10b7bad9

+ 6 - 2
allin-packages/channel-management-ui/src/components/ChannelSelector.tsx

@@ -57,8 +57,12 @@ export const ChannelSelector: React.FC<ChannelSelectorProps> = ({
 
   return (
     <Select
-      value={value?.toString()}
-      onValueChange={(val) => onChange?.(parseInt(val))}
+      value={value?.toString() || ''}
+      onValueChange={(val) => {
+        if (val) {
+          onChange?.(parseInt(val));
+        }
+      }}
       disabled={disabled || isLoading || channelList.length === 0}
     >
       <SelectTrigger className={className} data-testid={testId}>

+ 6 - 2
allin-packages/company-management-ui/src/components/CompanySelector.tsx

@@ -81,8 +81,12 @@ export const CompanySelector: React.FC<CompanySelectorProps> = ({
 
   return (
     <Select
-      value={value?.toString()}
-      onValueChange={(val) => onChange?.(parseInt(val))}
+      value={value?.toString() || ''}
+      onValueChange={(val) => {
+        if (val) {
+          onChange?.(parseInt(val));
+        }
+      }}
       disabled={disabled || isLoading || companyList.length === 0}
     >
       <SelectTrigger className={className} data-testid={testId}>

+ 6 - 2
allin-packages/platform-management-ui/src/components/PlatformSelector.tsx

@@ -57,8 +57,12 @@ export const PlatformSelector: React.FC<PlatformSelectorProps> = ({
 
   return (
     <Select
-      value={value?.toString()}
-      onValueChange={(val) => onChange?.(parseInt(val))}
+      value={value?.toString() || ''}
+      onValueChange={(val) => {
+        if (val) {
+          onChange?.(parseInt(val));
+        }
+      }}
       disabled={disabled || isLoading || platformList.length === 0}
     >
       <SelectTrigger className={className} data-testid={testId}>