Repository navigation
Update Ui add button history - #34
Conversation
📝 Walkthrough>ImportReceiptHistoryModal: historyList[]ImportReceiptHistoryModal-->>ApprovalsView: emit close |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/ImportReceiptHistoryModal.vue`:
- Around line 29-35: Trong ImportReceiptHistoryModal, giá trị trả về từ
getImportReceiptHistory có thể là null/undefined hoặc không phải mảng, khiến
historyList và template historyList.length bị lỗi khi render. Hãy cập nhật logic
trong hàm tải dữ liệu để luôn gán historyList.value về một mảng an toàn sau khi
gọi getImportReceiptHistory(id), và giữ nguyên xử lý lỗi trong catch/finally để
component chỉ render với dữ liệu dạng mảng.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d8de6813-1cc7-4d11-bd2a-b064b30ba39b
📒 Files selected for processing (5)
src/components/ImportReceiptHistoryModal.vuesrc/services/importReceiptService.jssrc/style.csssrc/views/ApprovalsView.vuesrc/views/StockDocumentsView.vue
| try { | ||
| historyList.value = await getImportReceiptHistory(id) | ||
| } catch (err) { | ||
| errorMessage.value = err.message || 'Không thể tải lịch sử duyệt.' | ||
| } finally { | ||
| isLoading.value = false | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Cần phòng trường hợp API trả về null/không phải mảng.
Nếu getImportReceiptHistory trả về null/undefined (body rỗng từ backend), historyList.value thành null, và template historyList.length === 0 sẽ ném lỗi khi render. Nên ép về mảng:
🛡️ Đề xuất guard
- historyList.value = await getImportReceiptHistory(id)
+ const data = await getImportReceiptHistory(id)
+ historyList.value = Array.isArray(data) ? data : (data?.content ?? [])📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| historyList.value = await getImportReceiptHistory(id) | |
| } catch (err) { | |
| errorMessage.value = err.message || 'Không thể tải lịch sử duyệt.' | |
| } finally { | |
| isLoading.value = false | |
| } | |
| try { | |
| const data = await getImportReceiptHistory(id) | |
| historyList.value = Array.isArray(data) ? data : (data?.content ?? []) | |
| } catch (err) { | |
| errorMessage.value = err.message || 'Không thể tải lịch sử duyệt.' | |
| } finally { | |
| isLoading.value = false | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/ImportReceiptHistoryModal.vue` around lines 29 - 35, Trong
ImportReceiptHistoryModal, giá trị trả về từ getImportReceiptHistory có thể là
null/undefined hoặc không phải mảng, khiến historyList và template
historyList.length bị lỗi khi render. Hãy cập nhật logic trong hàm tải dữ liệu
để luôn gán historyList.value về một mảng an toàn sau khi gọi
getImportReceiptHistory(id), và giữ nguyên xử lý lỗi trong catch/finally để
component chỉ render với dữ liệu dạng mảng.
Summary by CodeRabbit