From 760e8d900ef0a9dc91dae31949aba555c9624d9c Mon Sep 17 00:00:00 2001 From: plebeius Date: Thu, 16 Oct 2025 23:16:38 +0200 Subject: [PATCH] fix: remove unused variables from catalog and post views - catalog.tsx: Remove unused 'coloredFeed' variable assignment in useMemo - post.tsx: Remove unused 'useState' import The useMemo in catalog.tsx still executes its side effects (applying filter colors to the store) without needing to assign the return value. --- src/views/catalog/catalog.tsx | 5 ++--- src/views/post/post.tsx | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/views/catalog/catalog.tsx b/src/views/catalog/catalog.tsx index a8da37fb..efa9d511 100644 --- a/src/views/catalog/catalog.tsx +++ b/src/views/catalog/catalog.tsx @@ -461,8 +461,8 @@ const Catalog = () => { }; }, [clearMatchedFilters, subplebbitAddress]); - // Apply filter colors to posts when feed changes - const coloredFeed = useMemo(() => { + // Memoize filter color application to avoid redundant iterations + useMemo(() => { if (combinedFeed.length > 0 && filterItems.length > 0) { // Clear existing matched filters clearMatchedFilters(); @@ -482,7 +482,6 @@ const Catalog = () => { } }); } - return combinedFeed; }, [combinedFeed, filterItems, clearMatchedFilters]); return ( diff --git a/src/views/post/post.tsx b/src/views/post/post.tsx index 5fb7b3a1..c1ba138c 100644 --- a/src/views/post/post.tsx +++ b/src/views/post/post.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { Comment, Role, useComment, useEditedComment, useSubplebbit } from '@plebbit/plebbit-react-hooks'; import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';