From c630c0d7ebd1e4ca5ce777d5e992b2bfc3892d5d Mon Sep 17 00:00:00 2001 From: Antonio Bergas Date: Wed, 17 May 2023 21:29:35 +0200 Subject: [PATCH] refactor(microsite/src/pages/plugins/index.tsx): Refactor of newSelectedCategories Co-authored-by: Ben Lambert Signed-off-by: Antonio Bergas --- microsite/src/pages/plugins/index.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/microsite/src/pages/plugins/index.tsx b/microsite/src/pages/plugins/index.tsx index 2349e391fa..02f7854110 100644 --- a/microsite/src/pages/plugins/index.tsx +++ b/microsite/src/pages/plugins/index.tsx @@ -56,15 +56,9 @@ const Plugins = () => { ); const isSelected = category?.isSelected || false; - let newSelectedCategories = selectedCategories; - - if (isSelected) { - newSelectedCategories = selectedCategories.filter( + const newSelectedCategories = isSelected ? selectedCategories.filter( c => c !== categoryName, - ); - } else { - newSelectedCategories.push(categoryName); - } + ) : selectedCategories.push(categoryName); setSelectedCategories(newSelectedCategories);