(e: React.FormEvent)
| 31 | const addComment = useMutation(api.comments.add) |
| 32 | |
| 33 | const handleSubmit = async (e: React.FormEvent) => { |
| 34 | e.preventDefault() |
| 35 | if (!content.trim()) return |
| 36 | |
| 37 | setIsSubmitting(true) |
| 38 | setError(null) |
| 39 | |
| 40 | try { |
| 41 | await addComment({ |
| 42 | extensionId, |
| 43 | parentId, |
| 44 | content: content.trim(), |
| 45 | }) |
| 46 | setContent("") |
| 47 | onSuccess?.() |
| 48 | } catch (err) { |
| 49 | setError(err instanceof Error ? err.message : "Failed to post comment") |
| 50 | } finally { |
| 51 | setIsSubmitting(false) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | return ( |
| 56 | <form onSubmit={handleSubmit} className="flex flex-col gap-3"> |
nothing calls this directly
no outgoing calls
no test coverage detected