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