This commit is contained in:
2026-09-25 15:21:02 +05:30
parent 72f3bb0961
commit d169d24934
12 changed files with 516 additions and 28 deletions

View File

@@ -757,3 +757,19 @@ export function useRiderLive(userids: readonly number[], isEnabled = true) {
isFetching: results.some((result) => result.isFetching),
};
}
/**
* What is in one order — the line items, and the total Fiesta computed.
*
* Enabled only when a drawer is actually open on an order, because this is a
* request per order and the list behind it can hold hundreds. A delivery row
* carries the same `orderheaderid`, so the same hook serves both kinds of sheet.
*/
export function useOrderItems(orderheaderid: number | undefined) {
return useQuery({
queryKey: queryKeys.insights.orderItems(orderheaderid ?? 0),
queryFn: () => insightsApi.orderItems(orderheaderid as number),
enabled: Boolean(orderheaderid),
...stable,
});
}