fix(freshness): converge invalidation sets; global query-error toast; silent-toggle feedback
- OrderDetail/InvoiceDetail/LeaveRequests mutations now invalidate the same domain sets as their list-page twins (orders+offers+projects+invoices / +projects / +users+dashboard) — no more stale project/order labels after a detail-page action. - USER_INVALIDATE hoisted to lib/queries/users.ts; DashProfile self-edit now refreshes trips/attendance/leave/projects like an admin edit. - Global QueryCache.onError toast: failed first-loads no longer masquerade as empty lists (data-present refetches stay silent; Unauthorized skipped; 4s rate limit; meta.suppressGlobalErrorToast opt-out used by offer/issued-order detail + the local TOTP QR query). - Users/Vehicles active-toggle mutations toast on error (was silent revert); clickable status chips got affordance tooltips (incl. warehouse parity). - AuditLog: refetchOnMount always + staleTime 0 (mutations write audit rows but nothing invalidates the key); search debounced; dead auditLogOptions module removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -116,7 +116,7 @@ export default function OrderDetail() {
|
||||
useEffect(() => {
|
||||
if (orderQuery.error) {
|
||||
alert.error("Nepodařilo se načíst objednávku");
|
||||
navigate("/orders");
|
||||
navigate("/orders?tab=prijate");
|
||||
}
|
||||
}, [orderQuery.error]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
@@ -159,13 +159,13 @@ export default function OrderDetail() {
|
||||
const statusMutation = useApiMutation<{ status: string }, unknown>({
|
||||
url: () => `${API_BASE}/orders/${id}`,
|
||||
method: () => "PUT",
|
||||
invalidate: ["orders", "invoices"],
|
||||
invalidate: ["orders", "offers", "projects", "invoices"],
|
||||
});
|
||||
|
||||
const notesMutation = useApiMutation<{ notes: string }, unknown>({
|
||||
url: () => `${API_BASE}/orders/${id}`,
|
||||
method: () => "PUT",
|
||||
invalidate: ["orders", "invoices"],
|
||||
invalidate: ["orders", "offers", "projects", "invoices"],
|
||||
});
|
||||
|
||||
const orderDeleteMutation = useApiMutation<
|
||||
@@ -174,7 +174,7 @@ export default function OrderDetail() {
|
||||
>({
|
||||
url: () => `${API_BASE}/orders/${id}`,
|
||||
method: () => "DELETE",
|
||||
invalidate: ["orders", "invoices"],
|
||||
invalidate: ["orders", "offers", "projects", "invoices"],
|
||||
});
|
||||
|
||||
if (!hasPermission("orders.view")) return <Forbidden />;
|
||||
@@ -277,7 +277,7 @@ export default function OrderDetail() {
|
||||
try {
|
||||
await orderDeleteMutation.mutateAsync({ delete_files: deleteFiles });
|
||||
alert.success("Objednávka byla smazána");
|
||||
navigate("/orders");
|
||||
navigate("/orders?tab=prijate");
|
||||
} catch (e) {
|
||||
alert.error(e instanceof Error ? e.message : "Chyba připojení");
|
||||
} finally {
|
||||
@@ -396,7 +396,7 @@ export default function OrderDetail() {
|
||||
>
|
||||
<Button
|
||||
component={RouterLink}
|
||||
to="/orders"
|
||||
to="/orders?tab=prijate"
|
||||
variant="outlined"
|
||||
color="inherit"
|
||||
startIcon={BackIcon}
|
||||
|
||||
Reference in New Issue
Block a user