Skip to content

Commit 76534d1

Browse files
committed
refactor: remove keyword argument
1 parent ca48f13 commit 76534d1

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/App.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ export default function App() {
2525
onKeyDown={(e) => {
2626
if (e.key === 'Enter' && promiseRef.current) {
2727
e.preventDefault()
28-
// `e.currentTarget` will be null after `await`
29-
const _keyword = e.currentTarget.value
30-
keyword = _keyword
28+
keyword = e.currentTarget.value
3129
promiseRef.current
3230
.then((allComments) => {
33-
const comments = searchComments(allComments, _keyword)
31+
const comments = searchComments(allComments)
3432
setComments(comments)
3533
})
3634
.catch((e) => {
@@ -112,7 +110,7 @@ const CommentTree: React.FC<CommentProps> = ({ comments, sub = false }) => {
112110
)
113111
}
114112

115-
function searchComments(allComments: Reply[], keyword: string) {
113+
function searchComments(allComments: Reply[]) {
116114
return allComments.filter((comment) => {
117115
return (
118116
comment.content.message.includes(keyword) ||

0 commit comments

Comments
 (0)