Skip to content

App downloads too many of my contributions, without reason#4916

Merged
nicolas-raoul merged 4 commits intocommons-app:masterfrom
devarsh-mavani-19:load_contribs
Mar 23, 2022
Merged

App downloads too many of my contributions, without reason#4916
nicolas-raoul merged 4 commits intocommons-app:masterfrom
devarsh-mavani-19:load_contribs

Conversation

@devarsh-mavani-19
Copy link
Contributor

Description (required)
App downloads all the contributions at once by making lot's of subsequent requests to API. Instead the contributions should be downloaded as users scrolls rather than all at once.

Fixes #4900

What changes did you make and why?
I removed the fetchContributions call inside of onItemAtFrontLoaded . this will prevent function calling when user is not at the end.

Tests performed (required)
prodDebug

@devarsh-mavani-19
Copy link
Contributor Author

devarsh-mavani-19 commented Mar 21, 2022

@nicolas-raoul after the change I have made here is the new behaviour.

when we open app,
Loads whatever is cached in room database locally.
as user scrolls and is about to reach end, makes API call to load more data. I have verified this by checking the logs.

Can you please also verify it? Thanks

Edit: also when we open app for first time there wil be a 3-4 requests and then it will wait until we scroll

Edit: will fix the test.

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

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

This seems to work great! :-)

@codecov
Copy link

codecov bot commented Mar 22, 2022

Codecov Report

Merging #4916 (bbf2775) into master (bd9531b) will decrease coverage by 0.11%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #4916      +/-   ##
============================================
- Coverage     51.11%   50.99%   -0.12%     
+ Complexity     2297     2290       -7     
============================================
  Files           341      341              
  Lines         15960    15959       -1     
  Branches       1410     1410              
============================================
- Hits           8158     8139      -19     
- Misses         7182     7200      +18     
  Partials        620      620              
Impacted Files Coverage Δ
...mons/contributions/ContributionBoundaryCallback.kt 82.05% <ø> (-0.45%) ⬇️
.../nrw/commons/category/CategoryContentProvider.java 12.50% <0.00%> (-14.29%) ⬇️
...w/commons/upload/categories/BaseDelegateAdapter.kt 35.29% <0.00%> (-11.77%) ⬇️
...a/fr/free/nrw/commons/review/ReviewController.java 79.06% <0.00%> (-8.14%) ⬇️
...va/fr/free/nrw/commons/category/CategoriesModel.kt 57.62% <0.00%> (-1.70%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd9531b...bbf2775. Read the comment docs.

@devarsh-mavani-19
Copy link
Contributor Author

This seems to work great! :-)

Thanks. I have removed unnecessary code from tests as well. can you please check that?

@nicolas-raoul nicolas-raoul merged commit 85bdcd5 into commons-app:master Mar 23, 2022
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.

App downloads too many of my contributions, without reason

2 participants