Skip to content

v1.37.0 -- Sales orders open in place, related records

Latest

Choose a tag to compare

@mhightower932 mhightower932 released this 20 Aug 21:30
9eac465

Sales orders open in place from any queue, a related-records tab, and admin tables that no longer hand a cell's state to the wrong record.

Added

Open sales orders in place from any queue (#459). The Backorders, Dashboard, RMA and Refunds pages could show an order but not open it, so reaching one meant navigating to Sales Orders, searching for the number you had just been looking at, and losing your place in the list. The SO edit modal moves out of SalesOrders.jsx into its own SalesOrderModal component, unchanged in behaviour, and the four queue pages mount it directly: clicking a row opens the order where you are, and closing it returns you to the same list at the same scroll position. SalesOrders.jsx keeps the list and the deep-link, dropping from about 2,300 lines to 150.

Rows now open from a named column rather than anywhere in the row, so selecting text in a cell to copy an SO number or a SKU no longer navigates.

Related records tab on the sales order modal (#458). An order rarely stands alone: a sale spawns a backorder, a refund mints a replacement, an exchange creates an RMA. Following those links meant reading a parent id off one screen and searching for it on another. GET /admin/sales-orders/<id>/related walks the family in both directions and returns ancestors, descendants and siblings with their status, type and relationship to the order asked about; each row opens that order in place.

The walk is depth-capped at 32 in both directions. sales_orders.parent_so_id is a self-FK with no CHECK forbidding a self-reference or a cycle, so an UPDATE pointing an ancestor at one of its own descendants would spin the recursive CTE forever and hang the request. Real families are three nodes deep at the most.

Fixed

Admin table rows keyed by record instead of array position (#457). Rows were keyed row.id || i, and no admin list payload carries a bare id, so every table in the admin fell through to the array index and React reconciled rows by position. A row removed from the middle of the list shifted every row below it up one index, and any cell holding state was handed a different record's props without remounting.

Fraud Review's memo box is where that surfaced: the note a CSR had typed stayed on screen while the order under it changed, so an edit-in-place wrote the note onto the wrong sales order.

DataTable gains a rowKey naming what identifies a row, either a field name or a function for the tables whose rows have no single id column. It resolves to undefined rather than falling back to the index, so a rowKey that silently misses on some rows is detectable instead of hidden. Every call site supplies one, and a test asserts that, so a new table cannot quietly reintroduce index keying.

Migrations

None.

Mobile

Zero mobile/ diffs. The current build (version 1.36.0, versionCode 13) remains current; no new APK for v1.37.0.

Verification

Merged-main suites: api 2990 passed, admin 193 passed, mobile 55 passed.