Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

PatientRepository.findAll() called twice in initial load. #2043

Closed
akshay-ap opened this issue May 4, 2020 · 3 comments · Fixed by #2044
Closed

PatientRepository.findAll() called twice in initial load. #2043

akshay-ap opened this issue May 4, 2020 · 3 comments · Fixed by #2044
Assignees
Labels
🐛bug issue/pull request that documents/fixes a bug patients issue/pull request that interacts with patients module
Milestone

Comments

@akshay-ap
Copy link
Contributor

🐛 Bug Report

ViewPatients.tsx calls dispatch(searchPatients(debouncedSearchText)) and dispatch(fetchPatients()) in initial load. Both of these functions call PatientRepository.findAll().
So, patients list is fetched twice initially which is redundant.

To Reproduce

Steps to reproduce the behavior:
Navigate to: <host:port>/patients

Expected behavior

PatientRepository.findAll() called only once in initial load.

Your Environment

  • node version: 14
  • fastify version: >=1.0.0
  • os: Windows

This needs to be fixed with or before #2026.

@marcosvega91
Copy link
Contributor

marcosvega91 commented May 4, 2020

Hi @akshay-ap I reproduce the issue.
It doesn't make sense to have dispatch(fetchPatients()) after #1970
I think that in this case you can open a new PR and fix the issue 🥳 , otherwise I can do .

@akshay-ap
Copy link
Contributor Author

I have the fix ready. I can raise the PR if you don't mind.

@marcosvega91
Copy link
Contributor

Go forward 👯

akshay-ap added a commit to akshay-ap/hospitalrun-frontend that referenced this issue May 4, 2020
ghost pushed a commit to akshay-ap/hospitalrun-frontend that referenced this issue May 4, 2020
ghost pushed a commit to akshay-ap/hospitalrun-frontend that referenced this issue May 4, 2020
@jackcmeyer jackcmeyer added 🐛bug issue/pull request that documents/fixes a bug good first issue indicates an issue is good for a first time contributor patients issue/pull request that interacts with patients module and removed good first issue indicates an issue is good for a first time contributor labels May 5, 2020
@jackcmeyer jackcmeyer added this to the v2.0 milestone May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛bug issue/pull request that documents/fixes a bug patients issue/pull request that interacts with patients module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants