mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 11:20:37 +09:00
fix(ui): repair issue detail split regressions
This commit is contained in:
parent
27ec1e0c8b
commit
1ac1dbcb3e
2 changed files with 5 additions and 33 deletions
|
|
@ -330,6 +330,7 @@ describe("inbox helpers", () => {
|
||||||
dashboard,
|
dashboard,
|
||||||
heartbeatRuns: [],
|
heartbeatRuns: [],
|
||||||
mineIssues: [makeIssue("1", false), makeIssue("2", false), makeIssue("3", true)],
|
mineIssues: [makeIssue("1", false), makeIssue("2", false), makeIssue("3", true)],
|
||||||
|
dismissedAlerts: new Set<string>(),
|
||||||
dismissedAtByKey: new Map(),
|
dismissedAtByKey: new Map(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,10 @@ type IssueDetailComment = (IssueComment | OptimisticIssueComment) & {
|
||||||
};
|
};
|
||||||
|
|
||||||
const FEEDBACK_TERMS_URL = import.meta.env.VITE_FEEDBACK_TERMS_URL?.trim() || "https://paperclip.ing/tos";
|
const FEEDBACK_TERMS_URL = import.meta.env.VITE_FEEDBACK_TERMS_URL?.trim() || "https://paperclip.ing/tos";
|
||||||
|
const ACTIVE_ISSUE_RUN_POLL_INTERVAL_MS = 3000;
|
||||||
|
const IDLE_ISSUE_RUN_POLL_INTERVAL_MS = 30000;
|
||||||
|
const ACTIVE_ISSUE_TIMELINE_POLL_INTERVAL_MS = 5000;
|
||||||
|
const IDLE_ISSUE_TIMELINE_POLL_INTERVAL_MS = 30000;
|
||||||
|
|
||||||
function asRecord(value: unknown): Record<string, unknown> | null {
|
function asRecord(value: unknown): Record<string, unknown> | null {
|
||||||
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
||||||
|
|
@ -664,39 +668,6 @@ export function IssueDetail() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const approvalDecision = useMutation({
|
|
||||||
mutationFn: async ({ approvalId, action }: { approvalId: string; action: "approve" | "reject" }) => {
|
|
||||||
if (action === "approve") {
|
|
||||||
return approvalsApi.approve(approvalId);
|
|
||||||
}
|
|
||||||
return approvalsApi.reject(approvalId);
|
|
||||||
},
|
|
||||||
onMutate: ({ approvalId, action }) => {
|
|
||||||
setPendingApprovalAction({ approvalId, action });
|
|
||||||
},
|
|
||||||
onSuccess: (_approval, variables) => {
|
|
||||||
invalidateIssue();
|
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.approvals.detail(variables.approvalId) });
|
|
||||||
if (resolvedCompanyId) {
|
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.approvals.list(resolvedCompanyId) });
|
|
||||||
}
|
|
||||||
pushToast({
|
|
||||||
title: variables.action === "approve" ? "Approval approved" : "Approval rejected",
|
|
||||||
tone: "success",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onError: (err, variables) => {
|
|
||||||
pushToast({
|
|
||||||
title: variables.action === "approve" ? "Approval failed" : "Rejection failed",
|
|
||||||
body: err instanceof Error ? err.message : "Unable to update approval",
|
|
||||||
tone: "error",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSettled: () => {
|
|
||||||
setPendingApprovalAction(null);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const addComment = useMutation({
|
const addComment = useMutation({
|
||||||
mutationFn: ({ body, reopen, interrupt }: { body: string; reopen?: boolean; interrupt?: boolean }) =>
|
mutationFn: ({ body, reopen, interrupt }: { body: string; reopen?: boolean; interrupt?: boolean }) =>
|
||||||
issuesApi.addComment(issueId!, body, reopen, interrupt),
|
issuesApi.addComment(issueId!, body, reopen, interrupt),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue