Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change all useDispatch to useQuery and request hooks in Consultations (src/Components/Facility/Consultations/**) #6416

Closed
wants to merge 30 commits into from

Conversation

AshrafMd-1
Copy link
Contributor

@AshrafMd-1 AshrafMd-1 commented Oct 7, 2023

WHAT

🤖 Generated by Copilot at aaab0f5

The pull request refactors the code for the facility consultations component and its subcomponents, using a custom request function and a routes object for making API calls, and simplifying the use of React hooks and state management. It also adds type annotations for some API routes and removes unused code and imports. This improves the code readability, consistency, and type safety.

Proposed Changes

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

HOW

🤖 Generated by Copilot at aaab0f5

@AshrafMd-1 AshrafMd-1 requested a review from a team October 7, 2023 16:35
@AshrafMd-1 AshrafMd-1 requested a review from a team as a code owner October 7, 2023 16:35
@AshrafMd-1 AshrafMd-1 requested a review from vigneshhari October 7, 2023 16:35
@vercel
Copy link

vercel bot commented Oct 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2023 9:28am

@netlify
Copy link

netlify bot commented Oct 7, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 0a1f73c
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/65378dedf444ec0008ede33f
😎 Deploy Preview https://deploy-preview-6416--care-egov-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AshrafMd-1 AshrafMd-1 changed the title change all useDispatch to useQuery and request hooks change all useDispatch to useQuery and request hooks in Consultations (src/Components/Facility/Consultations/**) Oct 7, 2023
@nihal467
Copy link
Member

@rithviknishad can you review it !

Copy link
Member

@rithviknishad rithviknishad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. For all GET requests dispatched during component initial render/mount should be using useQuery!

  2. If that request is a paginated response API, consider using the PaginatedList component instead as it'll handle most of the cases for you with minimal code. See example: https://github.com/coronasafe/care_fe/blob/develop/src/Components/Facility/LocationManagement.tsx

aeswibon and others added 2 commits October 17, 2023 06:29
…page (ohcnetwork#5347)

* fix(daily_round): added recommend_discharge as action

* fix: rebased the branch
* Middleware override feature in asset location

* Fix tooltip clipping

* Fix Flaky Cypress test in Facility Module  (ohcnetwork#6384)

* fix random facility page failure

* fix random facility page failure

* Revert "Prescriptions: Shrink discontinued prescriptions + Flip MAR timeline + Freeze primary columns in horizontal scroll (ohcnetwork#6282)" (ohcnetwork#6386)

This reverts commit 5009a86.

* Refactor Asset Model Import Formatting (ohcnetwork#6388)

* Refactor Asset Model Import Formatting

* fixes to warranty_amc_end_of_validity

* Fix asset import file for cypress

* Refactor: replaced Dispatch to useQuery/Request of src/Components/Auth/log… (ohcnetwork#6333)

* Refactor: replaced useDispatch to useQuery of src/Components/Auth/login.tsx

* fix:useQuery changed to Request

* feat: replaced dispatch with request

* fix: types and added pathparams

* fix: request body error

* Update Login.tsx

* change:Tres to Tbody

* fixes: response type change

* Update package-lock.json

* fix hover height (ohcnetwork#6352)

* Split routes of App Router (ohcnetwork#6363)

* Prescription: show prescribed on & by and discontinued date in detail card (ohcnetwork#6365)

* Fixed bug in location picker in update facility page (ohcnetwork#6377)

* add all cases for map rendering

* implement location pointer on searched location

* Added cam auto reset in asset config page (ohcnetwork#6375)

* 💊 Adds support for editing prescriptions +  Adds `useSlug` hook (ohcnetwork#6369)

* Adds hook: `useSlug`

* bug fix: NumericWithUnits field not showing intial value

* Form: support for showing global errors

* Adds support for editing prescriptions (fixes ohcnetwork#6340)

* Fix cypress

* fix cypress

* Improve design

---------

Co-authored-by: Mohammed Nihal <[email protected]>
Co-authored-by: Rithvik Nishad <[email protected]>
Co-authored-by: Aaron Jevil Nazareth <[email protected]>
Co-authored-by: Pranshu Aggarwal <[email protected]>
Co-authored-by: Gampa Sri Harsh <[email protected]>
Co-authored-by: Tasnimul H. Tauhid <[email protected]>
…/Components/ExternalResult/** ) (ohcnetwork#6402)

* replaced dispatch with useQuery in ResultList

* replaced useDispatch with useQuery in listfilter

* replaced useDispatch with reqeust in ExternalResultUpload

* fixed filtering

* fix ResultList

* rm clg

* make code readable

* fix build

* removed useEffect and useState from ResultList.tsx

* Apply changes from code review

---------

Co-authored-by: rithviknishad <[email protected]>
@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Oct 17, 2023
@github-actions
Copy link

👋 Hi, @AshrafMd-1,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

GokulramGHV and others added 13 commits October 17, 2023 06:33
…twork#6428)

* added cypress test to verify warranty expiry label

* updated spec to check if the warranty expiry label goes off once updated

* verify the last change

---------

Co-authored-by: Mohammed Nihal <[email protected]>
…rk#6374)

* changed to request in HL7monitor.tsx

* replaced dispatch in assetTypes

* changed dispatch in filteer, import files

* changed all dispatch requests with useQuery and request in asset module

* added TBody to various endpoints

* fixed assetfilter page

* fixed asset import modal page

* made requested changes

* made requested changes

* reverted to assetBedModel

* fixed delete asset function

* fixed after delete redirection

* removed extra setstates

* updated failing cypress tests for asset module

* removed useEffects

* removed changes from cypress files

* fixed merge issues

* fixed transactions issue

* remove console logs

----------

Co-authored-by: Rithvik Nishad <[email protected]>
* Replaced useDispatch with useQuery and request.

* Removed all relevant no longer used actions from actions.tsx

* Replaced Res to Type

* Added TBody.

* used abha in place of JSON.parse(value).

* Fixed mobile otp issue

* Replaced Rdata with Rerror

* Fixed link care context

---------

Co-authored-by: Khavin Shankar <[email protected]>
…of 15 mins) (ohcnetwork#6466)

* fix JWT token refresh fallback interval

* remove jwt_token_refresh_interval from `config.json`
…k#6435)

* fix(daily_round): aligned consciousness scale to mews

* fix(daily_round): removed optional description

* fix NeurologicalTables

* fix line break

---------

Co-authored-by: rithviknishad <[email protected]>
* Username search cypress test

* import error
* fix session expiry detection

* Fix logout bug
* Added test for importing and configuring an asset

* Revert few changes

* nits

* Migrated to POM approach

* Migrated patient_crud to POM approach

* reverted some chnages

* FIx

* Merge conflicts

* Fixed test

* Added test for patient_test

* nits

* add responsiveness to virtual nursing assistant card (ohcnetwork#6130)

* allow use stock as well (ohcnetwork#6115)

* fixed responsive issue of 'Update Log' button in patient consultation page (ohcnetwork#6113)

* fix multiple bed bug (ohcnetwork#6111)

* Fixed typo in Date format in Asset management (ohcnetwork#6105)

* Added padding to count block on patients page

* fixed date format in asset manage page

* show only items with no min value (ohcnetwork#6103)

* check for id in response (ohcnetwork#6100)

* Added Responsiveness to File upload (ohcnetwork#6096)

* add responsiveness

* refactor

* remove overlap (ohcnetwork#6094)

* fixed failing test

* Fix

* Fixed comments

* fix comments

* Fixed all comments

* Migrated test to new test suite

* Added upload file test

* fixed failing test

* Fix failing test

* Revert unwanted changes

* fixed conflict

* random failure fixed

* temporary fixed medicine selection

---------

Co-authored-by: Pranshu Aggarwal <[email protected]>
Co-authored-by: Gokulram A <[email protected]>
Co-authored-by: Kshitij Verma <[email protected]>
Co-authored-by: Mohammed Nihal <[email protected]>
@github-actions
Copy link

Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 24, 2023
@AshrafMd-1
Copy link
Contributor Author

Somehow this pull request literally also added cypress and other files so I will close this and add a new pr request

@AshrafMd-1 AshrafMd-1 closed this Oct 24, 2023
@AshrafMd-1 AshrafMd-1 deleted the Fix#6372 branch October 25, 2023 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes required merge conflict pull requests with merge conflict stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🛠️ Replace useDispatch w. useQuery/request: Consultations (src/Components/Facility/Consultations/**)