Repository navigation
fix(stock-adjustment-draft): report save failures and show description - #177
Conversation
two defects behind 'draft saved but not shown in Previous Draft Records': - submitStockAdjustmentDraft showed 'saved successfully' without checking response.statusCode, so a failed save looked successful and the draft was never persisted. alert the error and stop instead. - the draft list bound adjustment?.draftDescription but the field is draftDesc, so the Description column was always blank. fix the binding. (the empty list itself, when the save truly succeeds, is a backend/no-data matter — the list mapping is correct.)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Addresses the frontend defects behind: "Under Main Store → Stock Adjustment, drafts are saved successfully, but the saved draft records are not displayed under Previous Draft Records ('No records found'). Same in Sub-Store."
Investigation
The Previous-Draft-Records list mapping is correct (
filteredStockAdjustmentList.data = response.data— the right AMRIT envelope, verified byte-identical to the pre-migration app; it even fixed the original's broken facility param). So when a draft genuinely saved, "No records found" means the backend returned an emptydataarray — a backend/no-data matter, not a list bug.But two real frontend defects can make a draft appear saved yet be missing:
submitStockAdjustmentDraft()showed "saved successfully" inside thesubscribewithout checkingresponse.statusCode, so a failed save was reported as success — the draft never persisted and so never appears in the list. Fixed: ifstatusCode !== 200, show the error and stop.adjustment?.draftDescription, but the field isdraftDesceverywhere else — so the Description column was always empty. Fixed the binding.Note
The default date range on the Previous-Draft-Records page is "today only" (plus a timezone shift), which could also hide a just-saved draft at day boundaries — flagging separately as a possible follow-up; not changed here.