Skip to content

requestCache.set called with wrong argument order in multiple places — caching broken for fetchResources and getPatientResources #47

Description

@Deepanshu1230

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions