Skip to content

Commit 70a4f84

Browse files
MelvinBotbrunovjk
andcommitted
Remove redundant useMemo around activeKey
React Compiler is enabled and handles memoization automatically, making the manual useMemo wrapper unnecessary. Co-authored-by: Bruno Rocha <brunovjk@users.noreply.github.com>
1 parent a8b806e commit 70a4f84

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

src/hooks/useSearchTypeMenuSections.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,7 @@ const useSearchTypeMenuSections = (queryParams?: UseSearchTypeMenuSectionsParams
172172
return -1;
173173
}, [typeMenuSections, savedSearches, hash, similarSearchHash, sortBy, sortOrder, type]);
174174

175-
const activeKey = useMemo(() => {
176-
if (activeItemIndex < 0) {
177-
return undefined;
178-
}
179-
const flatItems = typeMenuSections.flatMap((section) => section.menuItems);
180-
return flatItems.at(activeItemIndex)?.key;
181-
}, [typeMenuSections, activeItemIndex]);
175+
const activeKey = activeItemIndex < 0 ? undefined : typeMenuSections.flatMap((section) => section.menuItems).at(activeItemIndex)?.key;
182176

183177
return {
184178
typeMenuSections,

0 commit comments

Comments
 (0)