aboutsummaryrefslogtreecommitdiff
path: root/src/utils/users.ts
diff options
context:
space:
mode:
authorLeon Jiang <35908040+leonyjiang@users.noreply.github.com>2021-03-08 05:48:09 -0500
committerLeon Jiang <35908040+leonyjiang@users.noreply.github.com>2021-03-08 05:48:09 -0500
commit1d4dd2b2e6496374063efe7a4e1f8bde5cab32b1 (patch)
tree81ba5496aa38f4d32dd5349f16356756c734c825 /src/utils/users.ts
parent190d60cca929fd3869dd4ee077ccdfa854adf4dd (diff)
Fix duplicate stores of a category
Diffstat (limited to 'src/utils/users.ts')
-rw-r--r--src/utils/users.ts2
1 files changed, 2 insertions, 0 deletions
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];