fix: Select 컴포넌트 빈 문자열 값 오류 수정

- Radix UI Select는 빈 문자열 value를 허용하지 않음
- "선택 안 함" 옵션의 값을 "" → "none"으로 변경
- onValueChange에서 "none" 체크하여 screenId를 null로 설정
This commit is contained in:
kjs 2025-11-14 18:13:28 +09:00
parent 7d1ecf718b
commit 2ec6e3e920
1 changed files with 17 additions and 10 deletions

View File

@ -222,23 +222,30 @@ export function ConditionalContainerConfigPanel({
</div>
) : (
<Select
value={section.screenId?.toString() || ""}
value={section.screenId?.toString() || "none"}
onValueChange={(value) => {
const screenId = value ? parseInt(value) : null;
const selectedScreen = screens.find(
(s) => s.screenId === screenId
);
updateSection(section.id, {
screenId,
screenName: selectedScreen?.screenName,
});
if (value === "none") {
updateSection(section.id, {
screenId: null,
screenName: undefined,
});
} else {
const screenId = parseInt(value);
const selectedScreen = screens.find(
(s) => s.screenId === screenId
);
updateSection(section.id, {
screenId,
screenName: selectedScreen?.screenName,
});
}
}}
>
<SelectTrigger className="h-7 text-xs">
<SelectValue placeholder="화면 선택..." />
</SelectTrigger>
<SelectContent>
<SelectItem value=""> </SelectItem>
<SelectItem value="none"> </SelectItem>
{screens.map((screen) => (
<SelectItem
key={screen.screenId}