fix(pleno-vue): sort OpenCustomerInvoiceTable flattened orders by id ASC

OpenCustomerInvoiceTable.getOrders concatenates orders across the customer's
open_invoices entries without sorting. The downstream InvoiceOrderTable renders
the resulting array in whatever order the parent arrived in, so the rendered
transaction table is non-deterministic across page loads.

Add a defensive ascending sort by id before returning the list.
This commit is contained in:
Worktree Fix Verifier
2026-08-10 20:14:42 +02:00
parent c9935d1e0a
commit 167050f80b
@@ -50,7 +50,16 @@ const getOrders = (object) => {
let invoice_orders = invoice.objects;
orders = orders.concat(invoice_orders);
}
return orders;
return orders
.slice()
.sort((left, right) => {
const leftId = Number.parseInt(String(left?.id ?? ""), 10);
const rightId = Number.parseInt(String(right?.id ?? ""), 10);
if (Number.isInteger(leftId) && Number.isInteger(rightId)) {
return leftId - rightId;
}
return String(left?.id ?? "").localeCompare(String(right?.id ?? ""));
});
}
getDepartments();