forked from tanner/qotnews
refactor: Remove unnecessary useCallback from comment functions
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -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'>
|
||||
|
||||
Reference in New Issue
Block a user