-
Notifications
You must be signed in to change notification settings - Fork 7
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
IA-3884: show groups version in dropdown #1939
Conversation
When creating on-the-fly configuration to restrict OrgUnit Change Request creation, the `created_at` and `updated_at` dates were not set. This resulted in the backend sending `null` for those required field. Those fields are now set to the current date and time to fix the issue in the mobile app. IA-3878
- in change requests config - in group sets table - in most groups dropdowns
- this will prevent errors in the front end when using dropdowns
- Improve handling of anon users
- Keep only useGetGroupDropdown - add default source version to its API call
- Remove unused useGetGroups - Update useGetOrgUnitDetailData to use /groups/dropdown endpoint - Update org unit forms to use dropdown API response - remove unused utils - remove unused TS type - Correct error in SaveData TS type
const groupsInputComponent = useMemo(() => { | ||
return createGroupsInputComponent({ | ||
isFetchingGroups, | ||
handleChange, | ||
filters, | ||
groups, | ||
}); | ||
}, [filters, groups, handleChange, isFetchingGroups]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a hidden component. I took it out. It introduces some repetition, but is more legible I think, and avoids the unnecessary useMemo
settings.row.original.groups.sort((a, b) => | ||
a.name > b.name ? 1 : b.name > a.name ? -1 : 0, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter was complaining about the nested ternary
const groupsDataSourceQueryParams = originalOrgUnit?.source_id | ||
? `?dataSource=${originalOrgUnit.source_id}` | ||
: undefined; | ||
const groupsQueryParams = isNewOrgunit | ||
? '?defaultVersion=true' | ||
: groupsDataSourceQueryParams; | ||
const groupsApiUrl = '/api/groups/dropdown/'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit of gymastic but:
- strings don't need to be memoized
- it allows me to pass just the params to the queryKey, so all group dropdown hooks have the same queryKey structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow this is very cool ! even better, now we are sharing same cache across pages
Follow up of #1933: use groups dropdown endpoint where indicated
Related JIRA tickets : IA-3880, IA-3884
Self proofreading checklist
Doc
Comments in the code
Changes
CampaignScope
,RoundScope
andSubActivityScope
naming to avoid react key errors in the front-endHow to test
Test in the UI:
Print screen / video
Screen.Recording.2025-01-22.at.18.07.55.mov
Screen.Recording.2025-01-22.at.18.03.42.mov
Screen.Recording.2025-01-22.at.18.07.55.mov
Notes
Includes hotfixes v1.251a and v1.251b
Follow the Conventional Commits specification
The merge message of a pull request must follow the Conventional Commits specification.
This convention helps to automatically generate release notes.
Use lowercase for consistency.
Example:
Note that the Jira reference is preceded by a line break.
Both the line break and the Jira reference are entered in the Add an optional extended description… field.