Codex-generated pull request#5
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on March 8
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| throw new Error(envelope.error?.message || "Request failed"); | ||
| } | ||
| return raw as T; | ||
| }; |
There was a problem hiding this comment.
Duplicate unwrapApiData function across two pages
Low Severity
The unwrapApiData function is identically copy-pasted into both dashboard.tsx and reports.tsx as a component-scoped helper. No shared utility exists for this pattern in client/src/lib or elsewhere. Extracting it to a shared module would reduce maintenance burden and ensure consistent envelope-unwrapping behavior across all pages.
Additional Locations (1)
| {safeInventoryItems.length > 0 | ||
| ? `${safeInventoryItems.length} items • Total Value: ${formatCurrency(calculateTotalValue(safeInventoryItems))}` | ||
| : `${stats?.totalItems || 0} items • Total Value: ${formatCurrency(stats?.inventoryValue || 0)}`} | ||
| {`${safeInventoryItems.length} items • Total Value: ${formatCurrency(calculateTotalValue(safeInventoryItems))}`} |
There was a problem hiding this comment.
Report preview lost stats fallback during loading
Medium Severity
The report preview header and footer previously fell back to stats?.totalItems and stats?.inventoryValue when safeInventoryItems was empty (e.g., during loading or on fetch error). The new code always shows safeInventoryItems.length and calculateTotalValue(safeInventoryItems), which displays "0 items • Total Value: $0.00" whenever inventory items haven't loaded yet, even if stats are already available.
Additional Locations (1)
| Cancel | ||
| </Button> | ||
| <Button type="submit" disabled={createWarehouse.isPending}> | ||
| <Button type="button" onClick={handleCreateSubmit} disabled={createWarehouse.isPending}> |
There was a problem hiding this comment.
Warehouse forms no longer submit on Enter key
Medium Severity
Both the create and edit warehouse forms replaced onSubmit handlers and type="submit" buttons with <form noValidate> (no onSubmit) and type="button" buttons with onClick. This removes the standard Enter-key-to-submit behavior. Users pressing Enter in any text input will no longer trigger handleCreateSubmit or handleEditSubmit, breaking a common form interaction pattern.


Codex generated this pull request, but encountered an unexpected error after generation. This is a placeholder PR message.
Codex Task
Note
Medium Risk
Moderate risk because it changes how several pages unwrap/validate API responses (including sending cookies) and alters the operational inventory payload to always include a numeric
price, which can affect downstream UI calculations and auth-dependent endpoints.Overview
Improves robustness of dashboard/report data loading by introducing a shared
unwrapApiDatahelper to handle{ ok, data, error }API envelopes and updating severalfetchcalls to usecredentials: "include".Hardens report rendering/calculations by normalizing inventory stats to numbers, guarding list endpoints as arrays, and coercing
price/quantityto numbers when computing values; the inventory report preview/footer now always reflects the current inventory feed instead of falling back tostats.Tightens warehouse create/edit UX by removing form submit handlers, adding explicit required-name validation with trimmed input, and switching submit buttons to explicit click actions. On the server,
listOperationalInventorynow selectsi.priceand normalizes it to a numericpricein the returned items.Written by Cursor Bugbot for commit bbe3541. This will update automatically on new commits. Configure here.