Description
In fetchResources and getPatientResources the arguments passed to requestCache.set are in the wrong order. because of this the cache never stores the data correctly and every single call goes to the network even when the same data was already fetched before. so the caching is completely useless in these two functions.
also in fetchMeasurementTypes a 4th argument 600000 is passed to set() but the method only takes 3 arguments so that value is silently ignored and the longer cache time never actually applies.
Proposed Solution
fix for fetchResources
// wrong
requestCache.set(cacheKey, params, normalizedResponse);
// correct
requestCache.set(cacheKey, normalizedResponse, params);
fix for getPatientResource
// wrong
requestCache.set(cacheKey, normalizedResponse, resourceParams);
// correct
requestCache.set(cacheKey, resourceParams, normalizedResponse);
Changes in File src/api.js
Description
In
fetchResourcesandgetPatientResourcesthe arguments passed torequestCache.setare in the wrong order. because of this the cache never stores the data correctly and every single call goes to the network even when the same data was already fetched before. so the caching is completely useless in these two functions.also in
fetchMeasurementTypesa 4th argument600000is passed toset()but the method only takes 3 arguments so that value is silently ignored and the longer cache time never actually applies.Proposed Solution
fix for fetchResources
fix for getPatientResource
Changes in File
src/api.js