fix(WEB): 견적 등록 제품 선택 목록 React key 오류 수정
- 제품 목록에서 null/undefined item_code 필터링 - 중복 item_code 제거 로직 추가 - key prop에 index 조합으로 고유성 보장
This commit is contained in:
@@ -813,11 +813,16 @@ export function QuoteRegistration({
|
||||
<SelectValue placeholder={isLoadingProducts ? "로딩 중..." : "제품을 선택하세요"} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{getFilteredProducts(formData.items[activeItemIndex].productCategory).map((product) => (
|
||||
<SelectItem key={product.item_code} value={product.item_code}>
|
||||
{product.item_name} ({product.item_code})
|
||||
</SelectItem>
|
||||
))}
|
||||
{getFilteredProducts(formData.items[activeItemIndex].productCategory)
|
||||
.filter((product) => product.item_code) // null/undefined 제외
|
||||
.filter((product, index, self) =>
|
||||
index === self.findIndex(p => p.item_code === product.item_code)
|
||||
)
|
||||
.map((product, index) => (
|
||||
<SelectItem key={`${product.item_code}-${index}`} value={product.item_code}>
|
||||
{product.item_name} ({product.item_code})
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</FormField>
|
||||
|
||||
Reference in New Issue
Block a user