fix(users): display isSelfServiceUser field in ViewUsers page#96
fix(users): display isSelfServiceUser field in ViewUsers page#96deepthi-kolipaka wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThe ViewUsers component now renders the self-service user status dynamically: it shows "Yes" when Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 get early access to new features in CodeRabbit.Enable the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/pages/users/ViewUsers.tsx`:
- Line 175: The users list rendering references users?.isSelfServiceUser which
is not provided by the /users/{id} schema, causing the ternary to default to
"No"; either remove that field from the UI or implement three-state rendering:
check for undefined and render a placeholder (e.g., "—") when
users?.isSelfServiceUser is undefined, "Yes" when true, and "No" when false;
update the JSX in ViewUsers (the expression containing users?.isSelfServiceUser)
accordingly so it no longer incorrectly shows "No" for missing data.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5ac982ce-04f7-4561-880c-a26b51674851
📒 Files selected for processing (1)
src/pages/users/ViewUsers.tsx
| <div className="font-medium">Is Self Service</div> | ||
| <div className="text-zinc-600 dark:text-zinc-400"> | ||
| {'Missing in OpenApi'} | ||
| {users?.isSelfServiceUser ? 'Yes' : 'No'} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Verify OpenAPI schema has isSelfServiceUser on /users/{id} response =="
SPEC_FILE="$(fd '^fineract\.ya?ml$' | head -n1)"
echo "Using spec: ${SPEC_FILE:-NOT_FOUND}"
if [ -n "${SPEC_FILE:-}" ]; then
rg -n -A40 -B5 'GetUsersUserIdResponse:' "$SPEC_FILE"
echo
rg -n 'isSelfServiceUser' "$SPEC_FILE" || true
fi
echo
echo "== Verify generated TS type includes isSelfServiceUser =="
rg -n -A25 -B5 'interface\s+GetUsersUserIdResponse|type\s+GetUsersUserIdResponse' src || true
rg -n 'isSelfServiceUser' src || trueRepository: openMF/mifos-x-web-app-react
Length of output: 4176
🏁 Script executed:
fd -e ts -e tsx -path "*/fineract-api/*" -type f | head -20Repository: openMF/mifos-x-web-app-react
Length of output: 240
🏁 Script executed:
fd -type f -name "*.ts" src/fineract-api | head -20Repository: openMF/mifos-x-web-app-react
Length of output: 242
🏁 Script executed:
fd fineract-api src --type dRepository: openMF/mifos-x-web-app-react
Length of output: 54
🏁 Script executed:
cat tsconfig.json | grep -A5 "@/"Repository: openMF/mifos-x-web-app-react
Length of output: 108
🏁 Script executed:
find src/fineract-api -type f -name "*.ts" | head -10Repository: openMF/mifos-x-web-app-react
Length of output: 123
🏁 Script executed:
rg "interface GetUsersUserIdResponse|type GetUsersUserIdResponse" -A30Repository: openMF/mifos-x-web-app-react
Length of output: 1869
🏁 Script executed:
rg "GetUsersUserIdResponse" --type-list | head -5 && rg -g "index.ts" "GetUsersUserIdResponse" -A20Repository: openMF/mifos-x-web-app-react
Length of output: 610
🏁 Script executed:
find . -name "index.ts" -o -name "index.js" | xargs rg "GetUsersUserIdResponse" 2>/dev/null | head -5Repository: openMF/mifos-x-web-app-react
Length of output: 411
🏁 Script executed:
rg -A5 -B2 "Missing in.*GetUsersUserIdResponse" ISSUES.mdRepository: openMF/mifos-x-web-app-react
Length of output: 160
Remove field access or implement three-state rendering.
isSelfServiceUser is missing from the /users/{id} response schema (documented in ISSUES.md). This causes the ternary to always evaluate to 'No' for all users. Either remove the field display until the schema is updated, or render a distinct state (e.g., —) for undefined values.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/pages/users/ViewUsers.tsx` at line 175, The users list rendering
references users?.isSelfServiceUser which is not provided by the /users/{id}
schema, causing the ternary to default to "No"; either remove that field from
the UI or implement three-state rendering: check for undefined and render a
placeholder (e.g., "—") when users?.isSelfServiceUser is undefined, "Yes" when
true, and "No" when false; update the JSX in ViewUsers (the expression
containing users?.isSelfServiceUser) accordingly so it no longer incorrectly
shows "No" for missing data.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/pages/users/ViewUsers.tsx (1)
174-174:⚠️ Potential issue | 🔴 CriticalBuild is blocked:
isSelfServiceUseris not inGetUsersUserIdResponse(TS2339).Line 174 fails compilation and also collapses missing data to
'No'. Please either regenerate/consume the updated OpenAPI types from PR#88, or add a temporary local extended type and render a third state when undefined.Proposed minimal fix (temporary, type-safe)
- const [users, setUsers] = useState<GetUsersUserIdResponse | null>(null) + type ViewUserResponse = GetUsersUserIdResponse & { isSelfServiceUser?: boolean } + const [users, setUsers] = useState<ViewUserResponse | null>(null) ... - {users?.isSelfServiceUser ? 'Yes' : 'No'} + {users?.isSelfServiceUser === undefined + ? '—' + : users.isSelfServiceUser + ? 'Yes' + : 'No'}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/users/ViewUsers.tsx` at line 174, The component is referencing users?.isSelfServiceUser which doesn't exist on GetUsersUserIdResponse (causing TS2339) and collapses undefined to "No"; fix by either pulling in the regenerated OpenAPI types that include isSelfServiceUser or add a local extended type (e.g., declare an ExtendedUser type that extends GetUsersUserIdResponse with isSelfServiceUser?: boolean) and update the ViewUsers rendering to explicitly handle three states (true => "Yes", false => "No", undefined => a third state like "—" or "Unknown") when reading users (the symbols to change are users, GetUsersUserIdResponse and the ViewUsers component).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/pages/users/ViewUsers.tsx`:
- Line 174: The component is referencing users?.isSelfServiceUser which doesn't
exist on GetUsersUserIdResponse (causing TS2339) and collapses undefined to
"No"; fix by either pulling in the regenerated OpenAPI types that include
isSelfServiceUser or add a local extended type (e.g., declare an ExtendedUser
type that extends GetUsersUserIdResponse with isSelfServiceUser?: boolean) and
update the ViewUsers rendering to explicitly handle three states (true => "Yes",
false => "No", undefined => a third state like "—" or "Unknown") when reading
users (the symbols to change are users, GetUsersUserIdResponse and the ViewUsers
component).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5926c8cb-fc8a-4ed3-9054-5675a21fabb6
📒 Files selected for processing (1)
src/pages/users/ViewUsers.tsx
|
CLA check = failed Please sign our CLA so this can be considered |
gkbishnoi07
left a comment
There was a problem hiding this comment.
your one workflow is failing please fix and please check david comment
Summary
Fixed the ViewUsers page to display the actual
isSelfServiceUservalue instead of the hardcoded 'Missing in OpenApi' text.
Problem
The
isSelfServiceUserfield was hardcoded as 'Missing in OpenApi'in the ViewUsers page because the field was missing from the
OpenAPI spec.
Changes
ViewUsers.tsxto displayisSelfServiceUseras 'Yes' or 'No'Screenshots
Before: Shows 'Missing in OpenApi'
After: Shows 'Yes' or 'No' based on actual value
Related
Summary by CodeRabbit