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 ? "로딩 중..." : "제품을 선택하세요"} />
|
<SelectValue placeholder={isLoadingProducts ? "로딩 중..." : "제품을 선택하세요"} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{getFilteredProducts(formData.items[activeItemIndex].productCategory).map((product) => (
|
{getFilteredProducts(formData.items[activeItemIndex].productCategory)
|
||||||
<SelectItem key={product.item_code} value={product.item_code}>
|
.filter((product) => product.item_code) // null/undefined 제외
|
||||||
{product.item_name} ({product.item_code})
|
.filter((product, index, self) =>
|
||||||
</SelectItem>
|
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>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|||||||
Reference in New Issue
Block a user