fix(groups): call update13 API on edit form submit#101
fix(groups): call update13 API on edit form submit#101deepthikolipaka wants to merge 1 commit intoopenMF:devfrom
Conversation
📝 WalkthroughWalkthroughThe EditGroups component was modified to integrate a server-side API call that persists group updates. The change adds an API invocation to the submit flow before navigation, along with import additions and minor formatting adjustments to JSX elements. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Important Merge conflicts detected (Beta)
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can customize the high-level summary generated by CodeRabbit.Configure the |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/groups/groups-view/group-actions/EditGroups.tsx (1)
94-99:⚠️ Potential issue | 🟡 MinorHarden the submit path for invalid IDs and failed saves.
Line 94 converts
idinline; if it ever becomes non-numeric, you can sendNaNto the API. Also, on failure (Line 98), users only get a console log and no in-UI feedback.🛡️ Proposed diff
const onSubmit = async () => { if (!id) return + const groupId = Number(id) + if (!Number.isFinite(groupId)) { + console.error('Invalid group id:', id) + return + } setSaving(true) try { const payload: any = { name: name.trim(), locale: 'en', dateFormat: 'dd MMMM yyyy', } @@ - await groupsApi.update13(Number(id), payload) + await groupsApi.update13(groupId, payload) navigate(`/groups/${id}/general`) } catch (err) { console.error('Failed to update group', err) + // Consider adding toast/inline error so users know save did not persist. } finally { setSaving(false) } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/groups/groups-view/group-actions/EditGroups.tsx` around lines 94 - 99, The submit handler currently calls groupsApi.update13(Number(id), payload) and console.errors on failure; first validate that id parses to a finite number (e.g., parseInt/Number and Number.isFinite) before calling groupsApi.update13 to avoid sending NaN, and bail out with an in-UI error if invalid; second, replace the console.error in the catch with user-visible feedback (set a component error state or dispatch a toast/notification) so the user sees save failures and optionally disable the submit button while saving; locate and update the code around update13, navigate and the submit handler in EditGroups.tsx to implement these checks and UI error handling.
🧹 Nitpick comments (1)
src/pages/groups/groups-view/group-actions/EditGroups.tsx (1)
8-12: UsePutGroupsGroupIdRequestfor the submit payload instead ofany.The request type is already imported on line 11 but line 82 still uses
any. This weakens compile-time checks for the update request shape. Since you've already added the type import, apply it to the payload:- const payload: any = { + const payload: PutGroupsGroupIdRequest = { name: name.trim(), locale: 'en', dateFormat: 'dd MMMM yyyy', }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/groups/groups-view/group-actions/EditGroups.tsx` around lines 8 - 12, Replace the loose any type used for the update payload with the imported PutGroupsGroupIdRequest type: locate the submit/update handler in EditGroups (the function that builds the payload and calls GroupsApi.putGroupsGroupId or similar) and change the payload variable/parameter annotation from any to PutGroupsGroupIdRequest so the request shape is type-checked; keep using the existing imported PutGroupsGroupIdRequest symbol and ensure the object you pass conforms to that interface before calling the API.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/pages/groups/groups-view/group-actions/EditGroups.tsx`:
- Around line 94-99: The submit handler currently calls
groupsApi.update13(Number(id), payload) and console.errors on failure; first
validate that id parses to a finite number (e.g., parseInt/Number and
Number.isFinite) before calling groupsApi.update13 to avoid sending NaN, and
bail out with an in-UI error if invalid; second, replace the console.error in
the catch with user-visible feedback (set a component error state or dispatch a
toast/notification) so the user sees save failures and optionally disable the
submit button while saving; locate and update the code around update13, navigate
and the submit handler in EditGroups.tsx to implement these checks and UI error
handling.
---
Nitpick comments:
In `@src/pages/groups/groups-view/group-actions/EditGroups.tsx`:
- Around line 8-12: Replace the loose any type used for the update payload with
the imported PutGroupsGroupIdRequest type: locate the submit/update handler in
EditGroups (the function that builds the payload and calls
GroupsApi.putGroupsGroupId or similar) and change the payload variable/parameter
annotation from any to PutGroupsGroupIdRequest so the request shape is
type-checked; keep using the existing imported PutGroupsGroupIdRequest symbol
and ensure the object you pass conforms to that interface before calling the
API.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ca74f604-a219-4bdd-912b-74652db09ad7
📒 Files selected for processing (1)
src/pages/groups/groups-view/group-actions/EditGroups.tsx
gkbishnoi07
left a comment
There was a problem hiding this comment.
Please create a Jira ticket for this task, or link the existing one if it already exists.
Also, please resolve the merge conflicts.
Problem
The EditGroups form was collecting all user input and building the
payload correctly, but never actually calling the API to save the changes.
Clicking "Submit" would silently navigate away without persisting anything
to the backend.
Fix
Added the missing
groupsApi.update13()call in theonSubmitfunctionso that changes are now saved to the Fineract backend before navigating
back to the group detail page.
Changes
await groupsApi.update13(Number(id), payload)in EditGroups.tsxPutGroupsGroupIdRequesttype to the importSummary by CodeRabbit
Bug Fixes
Style