Skip to content
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

Fix: The loading progress continues to display progress even after all parallel tasks have completed #458

Closed
luongvo opened this issue Apr 11, 2023 · 1 comment

Comments

@luongvo
Copy link
Member

luongvo commented Apr 11, 2023

Issue

We had a logic to show and hide the loading progress in BaseViewModel automatically. It was made to control showing and hiding the loading progress automatically for parallel tasks, such as parallel API calls at the screen loading time. Unfortunately, the current logic does not work stably, and it can not hide the loading when two of the tasks are finished at the same time.

👉 The loading progress continues to display progress even after all parallel tasks have completed

screen-20230411-104600 2023-04-11 11_17_41

  • Parallel API calls log
I/okhttp.OkHttpClient: --> GET http://192.168.1.122:3001/api/v1/documents/1116/routes
I/okhttp.OkHttpClient: x-mock-response-id: 18834730-2a3b4099-2d46-413e-8316-fe01ceb0c606
I/okhttp.OkHttpClient: DeviceID: 86cdf0440136bf29
I/okhttp.OkHttpClient: Authorization: Bearer xyz
I/okhttp.OkHttpClient: --> END GET
I/okhttp.OkHttpClient: --> GET http://192.168.1.122:3001/api/v1/documents/1116/reason-codes
I/okhttp.OkHttpClient: x-mock-response-id: 18834730-8662fe2e-f6b8-4ffc-bd74-7161062eea0d
I/okhttp.OkHttpClient: DeviceID: 86cdf0440136bf29
I/okhttp.OkHttpClient: Authorization: Bearer xyz
I/okhttp.OkHttpClient: --> END GET
I/okhttp.OkHttpClient: <-- 200 OK http://192.168.1.122:3001/api/v1/documents/1116/routes (1039ms)
I/okhttp.OkHttpClient: Content-Type: application/json; charset=utf-8
I/okhttp.OkHttpClient: Content-Length: 1270
I/okhttp.OkHttpClient: Date: Tue, 11 Apr 2023 04:13:43 GMT
I/okhttp.OkHttpClient: Connection: keep-alive
I/okhttp.OkHttpClient: Keep-Alive: timeout=5
I/okhttp.OkHttpClient: <-- 200 OK http://192.168.1.122:3001/api/v1/documents/1116/reason-codes (1035ms)
I/okhttp.OkHttpClient: Content-Type: application/json; charset=utf-8
I/okhttp.OkHttpClient: Content-Length: 2811
I/okhttp.OkHttpClient: Date: Tue, 11 Apr 2023 04:13:43 GMT
I/okhttp.OkHttpClient: Connection: keep-alive
I/okhttp.OkHttpClient: Keep-Alive: timeout=5
I/okhttp.OkHttpClient: {
I/okhttp.OkHttpClient:   ...
I/okhttp.OkHttpClient: }
I/okhttp.OkHttpClient: <-- END HTTP (1270-byte body)
I/okhttp.OkHttpClient: {
I/okhttp.OkHttpClient:   ...
I/okhttp.OkHttpClient: }
I/okhttp.OkHttpClient: <-- END HTTP (2811-byte body)

Expected

The loading progress should be hidden once all API calls have been completed, regardless of whether they were successful or failed.

Steps to reproduce

  1. Having a logic in ViewModel with parallel tasks, such as multiple API calls.
  2. Binding the loading from isLoading StateFlow.
  3. Re-check carefully multiple times.
@luongvo luongvo added this to the 3.19.0 milestone Apr 11, 2023
@luongvo luongvo self-assigned this Apr 11, 2023
@ryan-conway ryan-conway modified the milestones: 3.19.0, 3.20.0 May 2, 2023
@ryan-conway ryan-conway modified the milestones: 3.20.0, 3.21.0 Jun 1, 2023
@ryan-conway ryan-conway modified the milestones: 3.21.0, 3.22.0 Jun 30, 2023
@ryan-conway ryan-conway modified the milestones: 3.22.0, 3.24.0 Jul 27, 2023
@ryan-conway ryan-conway modified the milestones: 3.24.0, 3.25.0, 3.26.0 Aug 30, 2023
@ryan-conway ryan-conway modified the milestones: 3.26.0, 3.27.0 Oct 26, 2023
@ryan-conway ryan-conway modified the milestones: 3.27.0, 3.28.0 Dec 1, 2023
@ryan-conway ryan-conway modified the milestones: 3.28.0, 3.29.0 Dec 29, 2023
@ryan-conway ryan-conway modified the milestones: 3.29.0, 3.30.0 May 28, 2024
@ryan-conway
Copy link
Collaborator

Superseded by #576

@ryan-conway ryan-conway removed this from the 3.30.0 milestone May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants