From 8e74acfdc8df9585bd8f845aed401989230a6790 Mon Sep 17 00:00:00 2001 From: maradondt Date: Tue, 26 Sep 2023 22:01:58 +0200 Subject: [PATCH] fix: click on search btn init search --- src/components/App/SideBar/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/App/SideBar/index.tsx b/src/components/App/SideBar/index.tsx index 7c1c9f582..a58688265 100644 --- a/src/components/App/SideBar/index.tsx +++ b/src/components/App/SideBar/index.tsx @@ -2,8 +2,8 @@ import { Button, Slide } from '@mui/material' import { forwardRef, useEffect, useRef, useState } from 'react' import { useFormContext } from 'react-hook-form' import styled from 'styled-components' -import { SearchBar } from '~/components/SearchBar' import { Flex } from '~/components/common/Flex' +import { SearchBar } from '~/components/SearchBar' import { useAppStore } from '~/stores/useAppStore' import { useDataStore, useSelectedNode } from '~/stores/useDataStore' import { colors } from '~/utils/colors' @@ -68,8 +68,14 @@ const Content = forwardRef(({ onSubmit, subViewOpen { - setValue('search', '') - clearSearch() + if (searchTerm) { + setValue('search', '') + clearSearch() + + return + } + + onSubmit?.() }} > {!isLoading ? (