Skip to content

Commit

Issues: the ticks clear once Assign to g1t hands the issues over, and stay when it is refused

syntaqxcommitted Parent84450c4Browse files
1 file+7−10/1 viewed
+7−1
11 import { env } from "cloudflare:workers";
22 import { GitPullRequest, MessageSquare, Plus, Sparkles, X } from "lucide-react";
3+import { useEffect, useRef } from "react";
34 import { Form, Link, useRouteLoaderData } from "react-router";
45
56 import type { Route } from "./+types/issues";
9596 // An archived repository's issues are locked: no new ones.
9697 const layout = useRouteLoaderData("routes/repo/layout") as { repo?: { archivedAt?: string | null } } | undefined;
9798 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]);
98104 return (
99105 <div>
100106 <StateTabs
130136 );
131137 })}
132138 </div>
133− <Form method="post" className="mt-4">
139+ <Form ref={form} method="post" className="mt-4">
134140 {assignable && (
135141 <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">
136142 <Sparkles size={15} className="shrink-0 text-accent" />