Issues: the ticks clear once Assign to g1t hands the issues over, and stay when it is refused
1 file+7−10/1 viewed
| 1 | 1 | import { env } from "cloudflare:workers"; | |
| 2 | 2 | import { GitPullRequest, MessageSquare, Plus, Sparkles, X } from "lucide-react"; | |
| 3 | + | import { useEffect, useRef } from "react"; | |
| 3 | 4 | import { Form, Link, useRouteLoaderData } from "react-router"; | |
| 4 | 5 | ||
| 5 | 6 | import type { Route } from "./+types/issues"; | |
| 95 | 96 | // An archived repository's issues are locked: no new ones. | |
| 96 | 97 | const layout = useRouteLoaderData("routes/repo/layout") as { repo?: { archivedAt?: string | null } } | undefined; | |
| 97 | 98 | const archived = Boolean(layout?.repo?.archivedAt); | |
| 99 | + | // Handed over: the ticks are cleared. Refused: they stay, to try again. | |
| 100 | + | const form = useRef<HTMLFormElement>(null); | |
| 101 | + | useEffect(() => { | |
| 102 | + | if (actionData && !actionData.error) form.current?.reset(); | |
| 103 | + | }, [actionData]); | |
| 98 | 104 | return ( | |
| 99 | 105 | <div> | |
| 100 | 106 | <StateTabs | |
| 130 | 136 | ); | |
| 131 | 137 | })} | |
| 132 | 138 | </div> | |
| 133 | − | <Form method="post" className="mt-4"> | |
| 139 | + | <Form ref={form} method="post" className="mt-4"> | |
| 134 | 140 | {assignable && ( | |
| 135 | 141 | <div className="mb-3 flex flex-wrap items-center gap-3 rounded-xl border border-accent/30 bg-accent/5 px-4 py-2.5"> | |
| 136 | 142 | <Sparkles size={15} className="shrink-0 text-accent" /> |