-
Notifications
You must be signed in to change notification settings - Fork 249
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
(feat) useSWRImmutable
for fetching vitals concept metadata
#604
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since v1.0, SWR provides a helper hook useSWRImmutable to mark a resource as immutable. This means that once data is fetched and cached, it will not be requested again. Concept metadata is unlikely to change and as such revalidating is largely unnecessary. This PR modifies the `useVitalsConceptMetadata` hook to use `useSWRImmutable` for data fetching.
denniskigen
changed the title
(feat)
(feat) Mar 11, 2022
useSWRImmutable
for fetching vitals concept metadatauseSWRImmutable
for fetching vitals concept metadata
File size impactMerging swr-immutable into master impact files as follow: @openmrs/esm-form-entry-app (+8.02%)
@openmrs/esm-generic-patient-widgets-app (+0.02%)
@openmrs/esm-patient-allergies-app (+0.03%)
@openmrs/esm-patient-appointments-app (+0.03%)
@openmrs/esm-patient-attachments-app (+0.04%)
@openmrs/esm-patient-banner-app (no impact)
@openmrs/esm-patient-biometrics-app (+0.03%)
@openmrs/esm-patient-chart-app (+0.02%)
@openmrs/esm-patient-clinical-view-app (+0.04%)
@openmrs/esm-patient-common-lib (no impact)No file in @openmrs/esm-patient-common-lib group (see config below). {
"./packages/esm-patient-common-lib/dist/*.js": true,
"./packages/esm-patient-common-lib/dist/*.css": true,
"./packages/esm-patient-common-lib/dist/*.map": false,
"./packages/esm-patient-common-lib/dist/*.txt": false,
"./packages/esm-patient-common-lib/dist/*.json": false
} @openmrs/esm-patient-conditions-app (+0.04%)
@openmrs/esm-patient-forms-app (+0.04%)
@openmrs/esm-patient-immunizations-app (+0.04%)
@openmrs/esm-patient-medications-app (+0.02%)
@openmrs/esm-patient-notes-app (+0.04%)
@openmrs/esm-patient-programs-app (+0.04%)
@openmrs/esm-patient-test-results-app (+0.02%)
@openmrs/esm-patient-vitals-app (+0.02%)
|
brandones
approved these changes
Mar 11, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements
Summary
Starting from version 1.0 of SWR, we can use the useSWRImmutable hook to mark a resource as immutable. This means that once data is fetched and cached, it will not get revalidated again.
The
useVitalsConceptMetadata
hook fetches data from the concept resource. This data is unlikely to change very often.This PR modifies
useVitalsConceptMetadata
to use theuseSWRImmutable
hook for fetching data. It also removes an unused import from the vitals resource.