Files
edr-platform/apps/edr-freight-web/backoffice/src/lib/queryClient.ts
Marshal 17dc505d50 streamline booking detail components and enhance journey visualization
- Removed the BookingClearanceWorkflowBanner from ClearanceCard as the clearance progress is now integrated into the unified journey wizard.
- Eliminated the MilestoneTimeline component from DocumentsTab, consolidating customs progress into the JourneyWizard.
- Updated PageHeader to include a ContractReferenceLink for better navigation to contract details.
- Simplified ShipmentTrackingCard to focus on duty/tax payment slip upload, removing unnecessary milestone display.
- Integrated JourneyWizard component to visualize the booking journey, replacing the previous progress tracker.
- Enhanced ContractDetailPage to better categorize documents and improve user experience with clearer sections for profile, business license, clearance, and other documents.
- Introduced CSS for contracts table to manage column sizing and sticky headers effectively.
- Added ContractReferenceLink component for backoffice to link to contract details, ensuring consistent navigation across applications.
2026-07-19 07:06:58 +00:00

39 lines
1.4 KiB
TypeScript

import { MutationCache, QueryClient } from "@tanstack/react-query";
import type { InvalidatesMeta } from "@/utils/endpoint";
/**
* Single app-wide React Query client (do not nest additional providers).
*
* Declarative invalidation: any mutation built via `api.*.mutationOptions()`
* (see `services/api.ts` + `utils/endpoint.ts`) carries an `invalidates`
* function in its `meta`. The shared `MutationCache` below runs it on success
* and invalidates the returned query keys — so invalidation is declared once in
* the endpoint definition rather than re-wired in every component.
*/
export const queryClient = new QueryClient({
mutationCache: new MutationCache({
onSuccess: (data, variables, _context, mutation) => {
const invalidates = mutation.meta?.invalidates as
| InvalidatesMeta
| undefined;
if (typeof invalidates !== "function") return;
for (const queryKey of invalidates(variables, data)) {
void queryClient.invalidateQueries({ queryKey });
}
},
}),
defaultOptions: {
queries: {
retry: 1,
// staleTime: 30_000,
staleTime:0,
// Data freshness is driven by mutation invalidation (MutationCache above),
// socket pushes, and explicit polling — not by tab focus. Focus refetch
// just re-fires every mounted query each time the window is refocused.
refetchOnWindowFocus: false,
},
},
});