feat: connect search with input field search triggered by lens click and enter (MIN-63)
Objective:
Add the call to the search by clicking the lens or pressing Enter. API calls do not work when we do not change the input value after API calls or when some APIs have a pending status.
What has been done:
- Added
useSearchData
hook with API calls and status of queries - Added
usePrevious
hook - Added API call when lens button is clicked or Enter key is pressed
Additionally:
- added selector for drugs, chemicals, bioEntityContents, and miRNAs
- deleted
@types/images.d.ts
- deleted
renderComponentWithProvider
Merge request reports
Activity
requested review from @AdrianOrlow and @teoMiesiac
assigned to @mateuszmiko
added 1 commit
- de0347f9 - feat(search bar): add condition for api calls
added 1 commit
- 45c15f5f - feat(search bar): move useSearchData to hooks folder in SearchBar folder
- Resolved by mateuszmiko
- Resolved by mateuszmiko
- Resolved by mateuszmiko
- Resolved by mateuszmiko
- Resolved by mateuszmiko
useSearchData.tsx hook is RFC for me. During daily you said you wanted to save time / code? But in the end in my opinion you did not and complicated code a bit.
Creating store "search" would be my solution. This way you have on external space where you handle all the actions triggers, statuses and you can even save "prevSearch value". It would look much smoother. Additionally when we start working on
;
you are going to need such a place to trigger requests- Resolved by mateuszmiko
added 1 commit
- 041a896f - feat(search bar): move logic from hook to redux store
added 6 commits
-
041a896f...66410e7a - 5 commits from branch
development
- d9728978 - feat(search bar): fix conflicts with development
-
041a896f...66410e7a - 5 commits from branch
1 import { RenderResult, screen } from '@testing-library/react'; 2 import { renderComponentWithProvider } from '@/utils/renderComponentWithProvider'; 1 import drawerReducer from '@/redux/drawer/drawer.slice'; 2 import type { DrawerState } from '@/redux/drawer/drawer.types'; 3 import { ToolkitStoreWithSingleSlice } from '@/utils/createStoreInstanceUsingSliceReducer'; 4 import { getReduxWrapperUsingSliceReducer } from '@/utils/testing/getReduxWrapperUsingSliceReducer'; 5 import { render, screen } from '@testing-library/react'; 3 6 import { NavBar } from './NavBar.component'; 4 7 5 const renderComponent = (): RenderResult => renderComponentWithProvider(<NavBar />); 8 const renderComponent = (): { store: ToolkitStoreWithSingleSlice<DrawerState> } => {