From 7f8f13b57a9bd23b341ea383abdde8c5d2375415 Mon Sep 17 00:00:00 2001 From: Irfan Maulana Date: Tue, 20 Jul 2021 22:20:06 +0700 Subject: [PATCH] fix: conditional on filter --- components/search-form.tsx | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/components/search-form.tsx b/components/search-form.tsx index 8b39a1dfa..759a30b63 100644 --- a/components/search-form.tsx +++ b/components/search-form.tsx @@ -165,7 +165,22 @@ export function SearchForm({ {buckets.map((bucket: any, bIdx: number) => { if (bucket.key) { - if (checkDocSize && bucket.doc_count > 0) { + if (checkDocSize) { + if (bucket.doc_count > 0) { + return ( + + ); + } + // Do not print, when doc_count = 0 and checkDocSize set to true + return null; + } else { + // FAQ page doesn't check the doc_count + // just pass checkDocSize props to false return ( - ); } return null; })}