From 8737ec9a74292e6075ba5cbd74853198a6eb9ea2 Mon Sep 17 00:00:00 2001 From: wonderlandpark Date: Wed, 7 Apr 2021 10:13:13 +0900 Subject: [PATCH] fix: https://github.com/koreanbots/v2-testing/issues/75 --- components/Search.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/Search.tsx b/components/Search.tsx index a517a18..f2c05e1 100644 --- a/components/Search.tsx +++ b/components/Search.tsx @@ -1,6 +1,7 @@ import { useEffect, useRef, useState } from 'react' import { useRouter } from 'next/router' import Link from 'next/link' +import AbortController from 'abort-controller' import { makeBotURL, redirectTo } from '@utils/Tools' import Fetch from '@utils/Fetch' @@ -39,7 +40,7 @@ const Search = (): JSX.Element => { } const controller = new AbortController() setAbortControl(controller) - if (value.length > 2) setLoading(true) + if (value.length > 1) setLoading(true) const res = await Fetch(`/search/bots?q=${encodeURIComponent(value)}`, { signal: controller.signal, }) @@ -48,7 +49,7 @@ const Search = (): JSX.Element => { } const onSubmit = () => { - if(query.length < 3) return + if(query.length < 2) return if(!localStorage.recentSearch) localStorage.recentSearch = '[]' try { const d = JSON.parse(localStorage.recentSearch).reverse()