Skip to content

fix(feature:client): fix stuck loading & empty state for charges UI #2428

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

Merged
merged 8 commits into from
Jul 9, 2025

Conversation

biplab1
Copy link
Contributor

@biplab1 biplab1 commented Jul 4, 2025

Fixes - Jira-#459

Summary of changes:

  • Added @Serializable to all charge-related data classes to enable proper serialization/deserialization in API communication.
  • Fix stuck loading state by switching from collect to first() and handling empty DB results with a proper empty state UI
  • Currency formatting has been added based on the implementation in mifos-mobile.
  • Updated date format to display as 1 July 2025 instead of 2025-7-1
client-charges-loading-fix.webm

Charges List:

  • Displaying charges list fetched directly from API response (bypassing database save and read)
client-charges-direct-api-fetch.webm
  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

@biplab1 biplab1 changed the title fix(feature:client): fix loading and create charge issue in client charges fix(feature:client): fix stuck loading & empty state for charges UI Jul 5, 2025
@biplab1
Copy link
Contributor Author

biplab1 commented Jul 5, 2025

Note:

@biplab1 biplab1 marked this pull request as ready for review July 5, 2025 09:12
@revanthkumarJ
Copy link

@biplab1 can you upload the video to confirm the changes once

@biplab1 biplab1 closed this Jul 5, 2025
@biplab1 biplab1 force-pushed the MIFOSAC-459-client-charges branch from d49d242 to 210cc53 Compare July 5, 2025 09:27
@biplab1
Copy link
Contributor Author

biplab1 commented Jul 5, 2025

@niyajali Could you please reopen this PR? It mistakenly got closed.

@niyajali niyajali reopened this Jul 5, 2025
@biplab1 biplab1 marked this pull request as draft July 5, 2025 22:46
@biplab1 biplab1 force-pushed the MIFOSAC-459-client-charges branch from 085ed09 to d32ca3f Compare July 6, 2025 20:38
@biplab1 biplab1 marked this pull request as ready for review July 7, 2025 09:53
@biplab1 biplab1 requested a review from revanthkumarJ July 7, 2025 10:04
MifosPagingAppendProgress()
when (chargesPagingList.loadState.append) {
is LoadState.Error -> {}

Choose a reason for hiding this comment

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

when error occurs don't we need to show anything?

Copy link
Contributor Author

@biplab1 biplab1 Jul 7, 2025

Choose a reason for hiding this comment

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

Thanks for pointing that out! I've added MifosSweetError with an appropriate message.

Comment on lines 19 to 22
val code: String,
val name: String,
val decimalPlaces: Double,
val inMultiplesOf: Int,
val displaySymbol: String,
val nameCode: String,
val displayLabel: String,
val decimalPlaces: Double? = null,
val inMultiplesOf: Int? = null,
Copy link
Contributor

Choose a reason for hiding this comment

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

its always better to provide default values for fields, especially when the data class is used for network responses, give default values to code and name as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name and code fields for Currency are required and non-nullable, so a default value shouldn’t be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update:
I’ve made code and name nullable in the Currency class to safely handle cases where no currency is set up in the web app, and to prevent potential crashes. Let me know if you’d like me to handle it differently.

@biplab1 biplab1 force-pushed the MIFOSAC-459-client-charges branch from 4bba406 to 3d1a8dc Compare July 7, 2025 17:28
@biplab1
Copy link
Contributor Author

biplab1 commented Jul 9, 2025

@itsPronay @revanthkumarJ I have addressed all the comments you made. Please let me know if any further changes are needed. If everything looks good, kindly approve.

@therajanmaurya therajanmaurya merged commit 10625de into openMF:kmp-impl Jul 9, 2025
2 checks passed
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.

5 participants