From 1d4dd2b2e6496374063efe7a4e1f8bde5cab32b1 Mon Sep 17 00:00:00 2001 From: Leon Jiang <35908040+leonyjiang@users.noreply.github.com> Date: Mon, 8 Mar 2021 05:48:09 -0500 Subject: Fix duplicate stores of a category --- src/utils/users.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/utils/users.ts b/src/utils/users.ts index efae6d20..15107c99 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -213,6 +213,8 @@ export const addCategoryToRecentlySearched = async ( ); if (categoriesJSON) { categories = JSON.parse(categoriesJSON); + // TODO: make this more efficient by comparing shorter key + if (categories.find((c) => c.name === category.name)) return; categories.push(category); } else { categories = [category]; -- cgit v1.2.3-70-g09d2