()
| 78 | } |
| 79 | |
| 80 | const handleLike = async () => { |
| 81 | if (!isAuthenticated) return |
| 82 | |
| 83 | // Optimistic update |
| 84 | const newLiked = !liked |
| 85 | setLiked(newLiked) |
| 86 | setLikeCount((prev) => (newLiked ? prev + 1 : prev - 1)) |
| 87 | |
| 88 | try { |
| 89 | await toggleLike({ commentId: comment._id }) |
| 90 | } catch (err) { |
| 91 | // Revert on error |
| 92 | setLiked(!newLiked) |
| 93 | setLikeCount((prev) => (newLiked ? prev - 1 : prev + 1)) |
| 94 | console.error("Failed to toggle like:", err) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | if (comment.isDeleted) { |
| 99 | return ( |
nothing calls this directly
no outgoing calls
no test coverage detected