Skip to content
Snippets Groups Projects

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
Edited by mateuszmiko

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 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

  • mateuszmiko added 1 commit

    added 1 commit

    • 041a896f - feat(search bar): move logic from hook to redux store

    Compare with previous version

  • mateuszmiko added 6 commits

    added 6 commits

    Compare with previous version

  • mateuszmiko resolved all threads

    resolved all threads

  • mateuszmiko added 2 commits

    added 2 commits

    • 0114fa23 - test(search bar): add tests for search bar
    • 3a635d24 - feat(search bar): create new selector for check pending status

    Compare with previous version

  • mateuszmiko changed the description

    changed the description

  • 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> } => {
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading