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 blocking issue in main thread in the Notifications tab #20197

Merged

Conversation

jarvislin
Copy link
Contributor

@jarvislin jarvislin commented Feb 16, 2024

Fixes #20196

When I was profiling the threads, I found the main thread spent much time rendering the layouts. It continues re-rendering the UI even though the new data is the same as the old data.

截圖 2024-02-16 下午4 07 55

This PR contains:

  1. Stop updating our UI if the data is not changed so it uses DiffUtil for resolving the issue.
  2. Reduce the API requests for each tab. Only the first tab can fetch remote data when the view of fragment is created.
  3. Refactors

To Test:

  1. Open the Jetpack app and switch to the notifications tab.
  2. Change the tab to ALL/UNREAD/COMMENT...etc
  3. Scroll the notifications list
  4. Click the Like inline actions
  5. The Like state should be correct
  6. Done! Thank you!

P.S. We still have issues in main thread, but it is smoother than the original implementation.


Regression Notes

  1. Potential unintended areas of impact

    • Notifications tab
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • Manual
  3. What automated tests I added (or what prevented me from doing so)

    • None

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@jarvislin jarvislin changed the base branch from trunk to feature/notifications_refresh_p1 February 16, 2024 08:18
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 16, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20197-75b431d
Commit75b431d
Direct Downloadwordpress-prototype-build-pr20197-75b431d.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 16, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20197-75b431d
Commit75b431d
Direct Downloadjetpack-prototype-build-pr20197-75b431d.apk
Note: Google Login is not supported on these builds.

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Attention: 25 lines in your changes are missing coverage. Please review.

Comparison is base (fdd373b) 40.11% compared to head (75b431d) 40.11%.
Report is 13 commits behind head on feature/notifications_refresh_p1.

Files Patch % Lines
.../ui/notifications/NotificationsListFragmentPage.kt 0.00% 25 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##           feature/notifications_refresh_p1   #20197      +/-   ##
====================================================================
- Coverage                             40.11%   40.11%   -0.01%     
====================================================================
  Files                                  1469     1469              
  Lines                                 67755    67757       +2     
  Branches                              11226    11226              
====================================================================
  Hits                                  27179    27179              
- Misses                                38082    38084       +2     
  Partials                               2494     2494              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jarvislin jarvislin requested review from mkevins and antonis February 16, 2024 10:35
@jarvislin jarvislin self-assigned this Feb 16, 2024
@jarvislin jarvislin marked this pull request as ready for review February 16, 2024 10:35
Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Thank you for your work on this @jarvislin 🙇
I've tested the implementation and the perceived performance has improved compared with the main feature branch 🎉

@antonis antonis merged commit 0c81a3b into feature/notifications_refresh_p1 Feb 16, 2024
19 checks passed
@antonis antonis deleted the issue/20196-main-thread-blocking branch February 16, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🤖 Fix threading issues in the notifications tab
3 participants