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

Opening Achievement Screen also calls API of leaderboard, contribution fragment #6083

Open
neeldoshii opened this issue Dec 26, 2024 · 3 comments

Comments

@neeldoshii
Copy link
Contributor

Click on more, then from bottomsheet open Achievements. For some reason from logs you can see even being at Achievement Screen the leaderboard api is being called?

2024-12-26 21:03:22.611 OkHttpJsonApiClient     fr.free.nrw.commons                  I  Url https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/leaderboard.py?user=Devanonymous&duration=weekly&category=upload&limit=100&offset=0
2024-12-26 21:03:22.611 OkHttp                  fr.free.nrw.commons                  V  --> GET https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/leaderboard.py?user=Devanonymous&duration=weekly&category=upload&limit=100&offset=0
2024-12-26 21:03:22.611 OkHttp                  fr.free.nrw.commons                  V  --> END GET

Unable to share full logs due to github text limit.

Take it up while working at #6063

@parneet-guraya
Copy link
Contributor

parneet-guraya commented Dec 27, 2024

That is intended, because in the Profile screen we use Viewpager and it has page limit of 1 by default so it instantiate neighboring fragment and fragment does trigger a network request as it is instantiated. In this case opening Achievements fragment opens Leaderboard one too as it is next to it. and also if the fragment was in center it would have retained 1 on each (L&R) side. Hope that makes sense :-)

Screenshot from 2024-12-27 16-06-22

@neeldoshii
Copy link
Contributor Author

That is intended, because in the Profile screen we use Viewpager and it has page limit of 1 by default so it instantiate neighboring fragment and fragment does trigger a network request as it is instantiated. In this case opening Achievements fragment opens Leaderboard one too as it is next to it. and also if the fragment was in center it would have retained 1 on each (L&R) side. Hope that makes sense :-)

Yes you are correct. Apologies, my bad I didn't wrote the description clear. I think we should migrate from Viewpager to Viewpager2 since it uses RecyclerView.Adapter so it dynamically allocates and deallocates the left and right one's. Wdyt?

@parneet-guraya
Copy link
Contributor

I don't think it would be any different besides we want to have those pre instantiated for the faster context switches.

Also, since we already are picking up Jetpack compose, I think we should use that instead.

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

No branches or pull requests

2 participants