From 9ef390ef1ef69c964b62c304ee601b167ecf89bb Mon Sep 17 00:00:00 2001 From: Hagernesh Date: Fri, 10 Jul 2026 08:07:53 +0000 Subject: [PATCH] fix(warehouses): truck weighing modal resolves bookingId without the relation The modal read the booking id only from item.booking?.id, but inventory- workbench rows carry bookingId without the booking relation. Result: the container-weights and assigned-trucks queries never ran, so "Recorded net weight (system)" fell back to the inventory row's weight (often 0), the container MultiSelect never appeared, and the truck dropdown showed "not assigned" even when trucks existed - while the server correctly computed the cargo weight and rejected the mismatch. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/components/warehouses/ReleaseOrderModal.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/edr-freight-web/backoffice/src/components/warehouses/ReleaseOrderModal.tsx b/apps/edr-freight-web/backoffice/src/components/warehouses/ReleaseOrderModal.tsx index d986e2aba..cfa271076 100644 --- a/apps/edr-freight-web/backoffice/src/components/warehouses/ReleaseOrderModal.tsx +++ b/apps/edr-freight-web/backoffice/src/components/warehouses/ReleaseOrderModal.tsx @@ -112,7 +112,9 @@ const parseInspectionNote = (notes: string | null | undefined) => { export function ReleaseOrderModal({ opened, onClose, item, truckPrefill }: ReleaseOrderModalProps) { const { toast } = useToast(); const releaseMutation = useMutation(api.warehouses.release.mutationOptions()); - const bookingId = item?.booking?.id; + // Some openers (inventory workbench) supply bookingId without the booking + // relation — fall back to it, or the truck/container-weight queries never run. + const bookingId = item?.booking?.id ?? item?.bookingId ?? undefined; // Customer self-haul trucks assigned to this booking via the portal. const { data: customerTrucks = [] } = useQuery({ queryKey: ['release-customer-trucks', bookingId],