Skip to content

fix(groups): call update13 API on edit form submit#101

Open
deepthikolipaka wants to merge 1 commit intoopenMF:devfrom
deepthikolipaka:fix/edit-groups-api-call
Open

fix(groups): call update13 API on edit form submit#101
deepthikolipaka wants to merge 1 commit intoopenMF:devfrom
deepthikolipaka:fix/edit-groups-api-call

Conversation

@deepthikolipaka
Copy link

@deepthikolipaka deepthikolipaka commented Mar 18, 2026

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 the onSubmit function
so that changes are now saved to the Fineract backend before navigating
back to the group detail page.

Changes

  • Added await groupsApi.update13(Number(id), payload) in EditGroups.tsx
  • Added PutGroupsGroupIdRequest type to the import
  • Removed duplicate import line

Summary by CodeRabbit

  • Bug Fixes

    • Ensured group modifications are properly saved when submitting changes.
  • Style

    • Minor formatting improvements to group detail labels for better readability.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
EditGroups Form Submission
src/pages/groups/groups-view/group-actions/EditGroups.tsx
Added GroupsApi imports and integrated groupsApi.update13() call into the form submit flow to persist group changes. Includes minor formatting adjustments to breadcrumb label and activation date JSX elements.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A form that now speaks to the server's domain,
With updates that flow through the API's lane,
No more silent changes lost in the void—
The EditGroups panel is finally employed! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding the missing API call to persist group edits. It is concise, specific, and directly reflects the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Important

Merge conflicts detected (Beta)

  • Resolve merge conflict in branch fix/edit-groups-api-call
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟡 Minor

Harden the submit path for invalid IDs and failed saves.

Line 94 converts id inline; if it ever becomes non-numeric, you can send NaN to 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: Use PutGroupsGroupIdRequest for the submit payload instead of any.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f448968 and 9aa02c6.

📒 Files selected for processing (1)
  • src/pages/groups/groups-view/group-actions/EditGroups.tsx

Copy link
Collaborator

@gkbishnoi07 gkbishnoi07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a Jira ticket for this task, or link the existing one if it already exists.

Also, please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants