refactor: Remove unnecessary useCallback from comment functions

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2025-12-02 23:53:40 +00:00
parent 8472907730
commit 0f87d47536

View File

@@ -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 }) {
}
</div>
);
}, [collapsed, expanded, collapseComment, expandComment]);
};
return (
<div className='container'>