fix(client): Fixed the dropdown default visible account.#2574
fix(client): Fixed the dropdown default visible account.#2574therajanmaurya merged 6 commits intoopenMF:developmentfrom
Conversation
📝 WalkthroughWalkthroughAdded a nullable Changes
Sequence DiagramsequenceDiagram
participant VM as UpdateDefaultAccountViewModel
participant Repo as Repository
participant Accounts as AccountsList
participant Logger as Logger
participant UI as UIState
VM->>Repo: loadAccounts()
Repo-->>VM: accounts list
VM->>Repo: getClient(clientId)
Repo-->>VM: client (savingsAccountId)
VM->>Accounts: find index where account.id == savingsAccountId
alt found
VM->>VM: set currentSelectedIndex
VM->>UI: update selection
else not found
VM->>UI: leave selection unchanged
end
opt error
VM->>Logger: log exception
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
✏️ Tip: You can disable this entire section by setting 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 |
|
@techsavvy185 Could you please address the issue raised by @coderabbitai? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 14950 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 0
Thank you for following up! Let me clarify the issue I raised in my review. The IssueIn The problem: Even though the accounts were loaded successfully and the dropdown is fully functional, an error dialog would be shown to the user just because the pre-selection feature failed. This degrades the user experience unnecessarily. Recommended SolutionSince pre-selecting the default account is a secondary enhancement (nice-to-have), it shouldn't break the main account loading flow. Wrap the mutableStateFlow.update {
it.copy(
accounts = options,
dialogState = null,
)
}
try {
getClientSavingsAccountId()
} catch (e: Exception) {
// Pre-selection failed; dropdown still functional with loaded accounts
// Optionally log the error for debugging
}This way, if the pre-selection fails for any reason, the dropdown will still work with all the loaded accounts—the user just won't have a pre-selected default, which is acceptable fallback behavior. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientUpdateDefaultAccount/UpdateDefaultAccountViewModel.kt`:
- Around line 60-70: The catch block for getClientSavingsAccountId() currently
sets mutableStateFlow.update to an UpdateDefaultAccountState.DialogState.Error
which surfaces a non-critical pre-selection failure to the user; instead,
swallow or log the exception and do not modify dialogState. Replace the catch
body in UpdateDefaultAccountViewModel (the try invoking
getClientSavingsAccountId) to call the logger (or a debug/logging method
available in this class) with the exception (e.g., logger.warn or log(e)) and
return/ignore without calling mutableStateFlow.update or creating
UpdateDefaultAccountState.DialogState.Error so the UI remains unchanged.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientUpdateDefaultAccount/UpdateDefaultAccountViewModel.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: PR Checks / Static Analysis Check
🔇 Additional comments (1)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientUpdateDefaultAccount/UpdateDefaultAccountViewModel.kt (1)
105-115: LGTM!The function logic correctly retrieves the client's saved account ID and updates the selected index when a match is found. The
-1check properly handles the case where no matching account exists.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
.../kotlin/com/mifos/feature/client/clientUpdateDefaultAccount/UpdateDefaultAccountViewModel.kt
Show resolved
Hide resolved
biplab1
left a comment
There was a problem hiding this comment.
Looks good to me. This can be merged.
Fixes - Jira-#623
Screen_recording_20260114_171644.webm
Please make sure these boxes are checked before submitting your pull request - thanks!
Run the static analysis check
./gradlew checkorci-prepush.shto make sure you didn't break anythingIf you have multiple commits please combine them into one commit by squashing them.
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.