ui fix
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -90,6 +90,9 @@ export const queryKeys = {
|
||||
/** The directory — everyone, working today or not. */
|
||||
riderRoster: (tenantid: number) =>
|
||||
[...queryKeys.insights.all, 'rider-roster', tenantid] as const,
|
||||
/** What is in one order. Keyed by the order, never by the list it came from. */
|
||||
orderItems: (orderheaderid: number) =>
|
||||
[...queryKeys.insights.all, 'order-items', orderheaderid] as const,
|
||||
riderShifts: (applocationid: number) =>
|
||||
[...queryKeys.insights.all, 'rider-shifts', applocationid] as const,
|
||||
partners: (applocationid: number) =>
|
||||
|
||||
Reference in New Issue
Block a user