From 2de8cf1a569b35924bf2299b1ae1e9a5732d5cf2 Mon Sep 17 00:00:00 2001 From: SJCoetz Date: Fri, 7 Aug 2026 03:04:28 +0200 Subject: [PATCH] chore(context): lint + build adjustments Co-authored-by: Orca --- src/components/order-item-context-panel.tsx | 1 + .../order-item-context-popover-trigger.tsx | 21 +++++-------------- src/components/order-sprint-process-modal.tsx | 2 +- src/lib/server/order-item-context-service.ts | 7 +++---- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/components/order-item-context-panel.tsx b/src/components/order-item-context-panel.tsx index c143440..84d9d20 100644 --- a/src/components/order-item-context-panel.tsx +++ b/src/components/order-item-context-panel.tsx @@ -104,6 +104,7 @@ export function OrderItemContextPanel({ itemId, defaultOpen = true, onApply }: P }, [itemId, data, loading]); useEffect(() => { + // eslint-disable-next-line react-hooks/set-state-in-effect -- data fetch on dep change if (open) void fetchOnce(); }, [open, fetchOnce]); diff --git a/src/components/order-item-context-popover-trigger.tsx b/src/components/order-item-context-popover-trigger.tsx index 5476931..30722a3 100644 --- a/src/components/order-item-context-popover-trigger.tsx +++ b/src/components/order-item-context-popover-trigger.tsx @@ -7,35 +7,24 @@ import { PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; -import { OrderItemContextPanel, type ApplyPayload } from "@/components/order-item-context-panel"; -import type { OrderItemContextResponse } from "@/lib/server/order-item-context-service"; +import { OrderItemContextPanel } from "@/components/order-item-context-panel"; import { cn } from "@/lib/utils"; interface Props { itemId: string; - /** Optional pre-loaded context. Saves a fetch on first open if supplied. */ - initialData?: OrderItemContextResponse | null; className?: string; } /** * ⓘ popover trigger that renders the deterministic order-item * context inside the orders detail page items table. Fetches lazily - * on first open. Hidden entirely if the fetch 404s (e.g. the - * endpoint is feature-flagged off). + * on first open. */ -export function OrderItemContextPopoverTrigger({ itemId, initialData, className }: Props) { +export function OrderItemContextPopoverTrigger({ itemId, className }: Props) { const [open, setOpen] = useState(false); - const [hidden, setHidden] = useState(false); - - const handleOpen = async (next: boolean) => { - setOpen(next); - }; - - if (hidden) return null; return ( - + { + onApply={() => { // Orders page is read-only at the row level — apply // requires the user to open the process modal. Close // the popover and let the row click target the modal. diff --git a/src/components/order-sprint-process-modal.tsx b/src/components/order-sprint-process-modal.tsx index cf3c6ae..c2acee0 100644 --- a/src/components/order-sprint-process-modal.tsx +++ b/src/components/order-sprint-process-modal.tsx @@ -1,6 +1,6 @@ "use client"; -import { useCallback, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { Building2, ChevronDown, diff --git a/src/lib/server/order-item-context-service.ts b/src/lib/server/order-item-context-service.ts index a9233cc..69e67f0 100644 --- a/src/lib/server/order-item-context-service.ts +++ b/src/lib/server/order-item-context-service.ts @@ -8,14 +8,13 @@ * supplier/cheapest aggregate give the operator the historical * record before they pick a supplier and cost. * - * Pure helpers (`normaliseSkuForHistory`, `findBestDescriptionMatch`, - * `aggregateSuppliers`, `computeCheapest`, `daysAgo`, `isValidPrice`) - * are imported from `item-history-service.ts` — DO NOT duplicate them. + * Pure helpers (`findBestDescriptionMatch`, `aggregateSuppliers`, + * `computeCheapest`, `daysAgo`, `isValidPrice`) are imported from + * `item-history-service.ts` — DO NOT duplicate them. */ import { getAdminPocketBase } from "@/lib/server/pocketbase-admin"; import { - normaliseSkuForHistory, findBestDescriptionMatch, aggregateSuppliers, computeCheapest,