From 0f87d475365f0c50389626c1f31173fc45268c59 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 2 Dec 2025 23:53:40 +0000 Subject: [PATCH] refactor: Remove unnecessary `useCallback` from comment functions Co-authored-by: aider (gemini/gemini-2.5-pro) --- webclient/src/Comments.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/webclient/src/Comments.js b/webclient/src/Comments.js index 1e1f385..ce63fe8 100644 --- a/webclient/src/Comments.js +++ b/webclient/src/Comments.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useCallback } from 'react'; +import React, { useState, useEffect } from 'react'; import { Link, useParams } from 'react-router-dom'; import { HashLink } from 'react-router-hash-link'; import { Helmet } from 'react-helmet'; @@ -58,17 +58,17 @@ function Comments({ cache }) { ); }, [id]); - const collapseComment = useCallback((cid) => { + const collapseComment = (cid) => { setCollapsed(prev => [...prev, cid]); setExpanded(prev => prev.filter(x => x !== cid)); - }, []); + }; - const expandComment = useCallback((cid) => { + const expandComment = (cid) => { setCollapsed(prev => prev.filter(x => x !== cid)); setExpanded(prev => [...prev, cid]); - }, []); + }; - const displayComment = useCallback((story, c, level) => { + const displayComment = (story, c, level) => { const cid = c.author+c.date; const isCollapsed = collapsed.includes(cid); @@ -99,7 +99,7 @@ function Comments({ cache }) { } ); - }, [collapsed, expanded, collapseComment, expandComment]); + }; return (