Skip to content

Commit

Permalink
fix: click on search btn init search (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
maradondt authored Sep 27, 2023
1 parent a670568 commit 2f5eed9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/App/SideBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -68,8 +68,14 @@ const Content = forwardRef<HTMLDivElement, ContentProp>(({ onSubmit, subViewOpen
<SearchBar onSubmit={onSubmit} />
<InputButton
onClick={() => {
setValue('search', '')
clearSearch()
if (searchTerm) {
setValue('search', '')
clearSearch()

return
}

onSubmit?.()
}}
>
{!isLoading ? (
Expand Down

0 comments on commit 2f5eed9

Please sign in to comment.