From 2c1f2ff882842d7a28a932693016b5eeae67ca2f Mon Sep 17 00:00:00 2001 From: Ananth Venkatesh <46249765+quantum9Innovation@users.noreply.github.com> Date: Fri, 16 Feb 2024 20:10:45 +0000 Subject: [PATCH] Automatically redirect on sole result --- src/app/search/page.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx index 3dbab29..231ed6d 100644 --- a/src/app/search/page.tsx +++ b/src/app/search/page.tsx @@ -112,6 +112,11 @@ export default function Page() { router.push(input) } + if (data.length === 1) { + // auto redirect if only one result + handleRedirect(`/document/view/${data[0].id}`) + } + return (