feat: [DHIS2-21941] Self contained changelog widget - #4690
Open
henrikmv wants to merge 6 commits into
Open
Conversation
|
🚀 Deployed on https://deploy-preview-4690.capture.netlify.dhis2.org |
…etchFormattedValues logic
henrikmv
marked this pull request as ready for review
August 5, 2026 14:57
henrikmv
marked this pull request as draft
August 6, 2026 06:45
henrikmv
marked this pull request as ready for review
August 6, 2026 06:48
…vent-view-mode' into hv/chore/DHIS2-21941_SingleSourceChangelogValues
henrikmv
marked this pull request as draft
August 12, 2026 10:46
henrikmv
marked this pull request as ready for review
August 12, 2026 10:48
| entityId: string, | ||
| ) => queryClient.removeQueries([ReactQueryAppNamespace, 'changelog', entityType, entityId]); | ||
|
|
||
| export const removeEventChangelogQueries = (queryClient: QueryClient, eventId: string) => |
Contributor
There was a problem hiding this comment.
Overall, this refactor initiative looks ok to me. But I was thinking about invalidating the cache when an event's status changes, and I think the following use cases are not covered at the moment:
- The
Scenario: User can complete the enrollment and the active eventsfeature
- Completing events from the working lists
Should we address these in preparation for DHIS2-21919, or leave them for later? Thanks!
Contributor
Author
There was a problem hiding this comment.
Nice catch! I’ll do all the preparation for DHIS2-21919 now, which means including invalidating all the necessary caches.
Thanks!
|
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-21941
This PR makes changelog widgets self-contained by removing the
entityData/eventData/trackedEntityDataprops that were passed down from parent components. Instead, the changelog now fetches current entity values directly from the tracker API via a newuseCurrentEntityValueshook.Key changes
New
useCurrentEntityValueshook — fetches current values fromtracker/events/{id}ortracker/trackedEntities/{id}, replacing the prop-based approach.Improved
isLatestValuedetection — previously comparedchange.currentValueagainst a prop-provided snapshot. Now validates against both the newest changelog entry per field and fresh API data.Centralized
removeChangelogQueries— extracts duplicated cache invalidation into a shared utility, and adds invalidation for two new mutation sites:CompletionMenuItemandSkipAction.Opening the changelog now fires one extra tiny
tracker/{events|trackedEntities}/{id}?fields=…[…,value]fetch, but it runs in parallel with the (slower) changelog list request, is cached withstaleTime: Infinityso reopens are free, and is skipped entirely for changelogs withoutFILE_RESOURCE/IMAGEfields. In return, the widget becomes fully self-contained — no more entityData prop drilled from three different-shaped parent sources, and no more fragile?.valuehack that silently broke on stale parent caches.