chore: [DHIS2-20995] Limit fields param in the api requests#4559
Open
henrikmv wants to merge 15 commits into
Open
chore: [DHIS2-20995] Limit fields param in the api requests#4559henrikmv wants to merge 15 commits into
henrikmv wants to merge 15 commits into
Conversation
|
🚀 Deployed on https://deploy-preview-4559.capture.netlify.dhis2.org |
Contributor
simonadomnisoru
left a comment
There was a problem hiding this comment.
Good job! The PR description was very helpful for quickly understanding how the field parameters are used 🙌 . I only added one minor comment.
|
This file contains hidden or 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
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.



DHIS2-20995
Trims
fieldsparameters across 20 API queries to request only what's actually used.Field-by-field changes
Org unit queries
orgUnitFieldForForms.epicspublicAccess,access,lastUpdated,children[...]FILTERED_FORM_FIELD_ORG_UNITS_RETRIEVEDreducer intoSingleOrgUnitSelectField.component.tsx:48-50, which reads onlyid,displayName,pathOrgUnitField(FormFields/New)displayName,publicAccess,access,lastUpdated,children[...]OrgUnitTreewhich renders nodes lazily; the field-trimmed query only needsid,pathto seed the treeOrgUnitTree:allwildcard, root-levelid,displayName,pathTree/index.tsx:126renders onlylabel(=displayName) andvalue(=path) from thechildren[...]subtreeTeiSearch / searchOrgUnitSelector(×2)publicAccess,access,lastUpdated,children[...]orgUnitFieldForForms— result lands inSingleOrgUnitSelectField.component.tsx:48-50TEI / Event fetches
ExistingTEILoader*→attributes[attribute,value]ExistingTEIContents.component.tsx:37-41renders only the attribute values in aCardListuseEnrollmentcreatedBy,updatedByWidgetEnrollment.component.tsxreads onlystatus,followUp,enrolledAt,occurredAt,orgUnit,geometry,updatedAt(lines 77-177) — nevercreatedBy/updatedByuseLinkedEventByOriginId*inside theto[event[...]]subtreegetDataEntryDetails.ts:23-48reads onlyoccurredAt,scheduledAt,orgUnit,statusfrom the linked event; the*was an asymmetric over-fetch (fromside didn't have it)SearchForm.epics(×2)trackedEntityTypefrom result fieldsCardListItem.component.tsx:135derives program fromenrollments[0].program; the search result'strackedEntityTypewas never read (it's known from the query input)TrackerWorkingLists/getEventListData(createApiTEIsQueryArgs)enrollments[status,orgUnit,enrolledAt](keptenrollments[enrollment])status/orgUnit/enrolledAtcome from the enrollment widget's own fetchAccess / category metadata
getCategoriesDataFromEventaccess(defaults) →access[data[write]]getCategoriesDataFromEvent.ts:63reads onlyoption.access.data.writeuseRelationshipTypesaccess.read,access.write(keptaccess.data[read,write]).data.read/.data.writeonly; outer object-level access is never readloadCategoriesaccess[*]→access[data[write]]access.data.writechecks in the category-options selector pathCached program metadata (IndexedDB)
storeProgramsdescription,userRoles[id,displayName], narrowedaccess[*]→access[data[read,write]]program.descriptionorprogram.userRolesfrom the cached program; onlyaccess.data.*is checkedstoreProgramIndicatorscode,shortName,displayDescription(keptdescription)programIndicator.code,programIndicator.shortName, orprogramIndicator.displayDescriptionstoreProgramRulesdescriptionprogramRule.descriptionstoreRelationshipTypesreferralrelationshipType.referralWorking lists (listing vs. download split)
Split listing vs. download in working lists.** Working list endpoints used to fetch the full record because Working list downloads needed it — so every page load fetched everything. Now
LISTING_FIELDSis slim for in-app rendering;DOWNLOAD_FIELDSis full, applied only on the Working list download.EventWorkingLists/getEventListDataevent,program,programStage,status,occurredAt,orgUnit,assignedUser[uid,username,firstName,surname],dataValues[dataElement,value]dataValues,occurredAt,event,status,orgUnit,program,programType,updatedAt,createdAt,assignedUserTrackerWorkingLists/getEventListDataevent,status,program,enrollment,trackedEntity,occurredAt,scheduledAt,orgUnit,assignedUser[uid,username,firstName,surname],dataValues[dataElement,value](was
*)*getTeiListDatatrackedEntity,createdAt,inactive,attributes[attribute,value],programOwners[orgUnit,program](was
:all,!relationships,programOwners[...]):all,!relationships,programOwners[orgUnit,program]