From f0c8787e3f09927989be3a3d80600a2791789d2f Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 9 Oct 2026 10:22:28 +0200 Subject: [PATCH] fix(delivery-note-editor): the pricing route is PATCH, not POST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Could not save line 'Husqvarna 578BTF backpack leaf blower' (405)" — and nothing was written. `/api/v1/delivery-notes/items/[id]/pricing` exports PATCH only. The editor POSTed to it, so every save 405'd. The DN detail page has been PATCHing the same URL correctly all along; I should have matched it rather than assuming POST. ## Why it got through my verification My browser check opened the editor, typed a cost, watched the totals recompute — and stopped there. The save path is entirely separate from the render path, and I never pressed Save, so I verified the one half that was never broken. Redone properly: changed a quantity 150 -> 7, pressed Save, reopened the editor and read 7 back (the other three lines untouched at 150/150/2), then put it back to 150 so the data is as found. That is the check that matters on these screens — display and persistence are different code paths, and a perfectly-rendering dialog proves nothing about either. Suite: 3817 passing, tsc clean. --- .../delivery-notes/delivery-note-editor-dialog.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/delivery-notes/delivery-note-editor-dialog.tsx b/src/components/delivery-notes/delivery-note-editor-dialog.tsx index 9fa2f32..de106a1 100644 --- a/src/components/delivery-notes/delivery-note-editor-dialog.tsx +++ b/src/components/delivery-notes/delivery-note-editor-dialog.tsx @@ -159,7 +159,10 @@ export function DeliveryNoteEditorDialog({ const res = await fetch( `/api/v1/delivery-notes/items/${encodeURIComponent(line.orderItemId)}/pricing`, { - method: "POST", + // PATCH, not POST. The route only exports PATCH, and a + // POST to it answers 405 — which surfaced as + // "Could not save line ... (405)" and saved nothing. + method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ quantity: Math.max(1, Math.round(line.quantity)),