fix: quality audit — memory leaks, dead prose classes, stale state scope
- safe-markdown: add `cancelled` flag to async useEffect; no more setState after unmount when component is destroyed mid-import - rich-editor: same cleanup for preview tab effect; also remove dead `prose prose-sm max-w-none` classes (Tailwind Typography not installed) and replace with explicit arbitrary-selector markdown styling that actually renders using existing design tokens - profile-certificate-slot: drop dead `ORDER_LABEL`, `order` variable, and `physicalOrder` from `MineCertificateResponse`; physical orders are disabled — these were leftover references causing lint noise - learning-panel: change `issuingCert: boolean` → `issuingCertFor: number | null` so only the targeted user's button shows a spinner; a boolean shared across all users caused the wrong row to animate when the admin switched selected users mid-request Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import { useRouter } from "next/navigation";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { Award, Clock, Copy, ExternalLink, Loader2, Lock } from "lucide-react";
|
||||
import { http, toUserError } from "@/lib/api";
|
||||
import type { Certificate, CertificatePhysicalOrder } from "@/lib/types";
|
||||
import type { Certificate } from "@/lib/types";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { toast } from "@/components/providers";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -13,14 +13,6 @@ import { cn } from "@/lib/utils";
|
||||
type MineCertificateResponse = {
|
||||
certificate: Certificate | null;
|
||||
eligible: boolean;
|
||||
physicalOrder: CertificatePhysicalOrder | null;
|
||||
};
|
||||
|
||||
const ORDER_LABEL: Record<string, string> = {
|
||||
requested: "درخواست فیزیکی ثبت شد",
|
||||
paid: "پرداخت تأیید شد",
|
||||
shipped: "ارسال شد",
|
||||
cancelled: "درخواست فیزیکی لغو شده",
|
||||
};
|
||||
|
||||
export function ProfileCertificateSlot() {
|
||||
@@ -36,7 +28,6 @@ export function ProfileCertificateSlot() {
|
||||
|
||||
const cert = data?.certificate ?? null;
|
||||
const eligible = !!data?.eligible;
|
||||
const order = data?.physicalOrder;
|
||||
|
||||
// Auto-issue once when the student becomes eligible (same path as /cap).
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user