-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CMM-1037 Pagelist empty view #22413
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
base: trunk
Are you sure you want to change the base?
CMM-1037 Pagelist empty view #22413
Conversation
…dded subtitle resource
|
Claude finished @nbradbury's task in 1m 42s —— View job Code Review Complete ✓I've conducted a comprehensive code review of this PR. Overall, the implementation is clean and well-structured. Here are my findings: ✅ Positive Observations
🐛 Critical Issue: Logic Error in PageItemViewHolder.ktLocation: There's a critical bug in the subtitle visibility logic: pageItem.subtitleResource?.let { subtitleResource ->
emptyView.subtitle.text = emptyView.resources.getString(subtitleResource)
emptyView.subtitle.visibility = View.VISIBLE
} ?: {
emptyView.subtitle.visibility = View.GONE
}Problem: The Elvis operator ( Fix: Remove the braces on the else clause: pageItem.subtitleResource?.let { subtitleResource ->
emptyView.subtitle.text = emptyView.resources.getString(subtitleResource)
emptyView.subtitle.visibility = View.VISIBLE
} ?: run {
emptyView.subtitle.visibility = View.GONE
}Or use a more straightforward approach: if (pageItem.subtitleResource != null) {
emptyView.subtitle.text = emptyView.resources.getString(pageItem.subtitleResource)
emptyView.subtitle.visibility = View.VISIBLE
} else {
emptyView.subtitle.visibility = View.GONE
}Impact: Currently, when 📝 Other Observations
🔍 Code Quality Check
🎯 Recommendations
|
Generated by 🚫 Danger |
| pageItem.subtitleResource?.let { subtitleResource -> | ||
| emptyView.subtitle.text = emptyView.resources.getString(subtitleResource) | ||
| emptyView.subtitle.visibility = View.VISIBLE | ||
| } ?: { | ||
| emptyView.subtitle.visibility = View.GONE | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical Bug: This Elvis operator with a lambda doesn't work as expected. The lambda { emptyView.subtitle.visibility = View.GONE } is created but never executed.
Current behavior: When subtitleResource is null, nothing happens, leaving the subtitle potentially visible from a previous view.
Suggested fix:
| pageItem.subtitleResource?.let { subtitleResource -> | |
| emptyView.subtitle.text = emptyView.resources.getString(subtitleResource) | |
| emptyView.subtitle.visibility = View.VISIBLE | |
| } ?: { | |
| emptyView.subtitle.visibility = View.GONE | |
| } | |
| pageItem.subtitleResource?.let { subtitleResource -> | |
| emptyView.subtitle.text = emptyView.resources.getString(subtitleResource) | |
| emptyView.subtitle.visibility = View.VISIBLE | |
| } ?: run { | |
| emptyView.subtitle.visibility = View.GONE | |
| } |
Or use a simpler if/else:
if (pageItem.subtitleResource != null) {
emptyView.subtitle.text = emptyView.resources.getString(pageItem.subtitleResource)
emptyView.subtitle.visibility = View.VISIBLE
} else {
emptyView.subtitle.visibility = View.GONE
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
| App Name | Jetpack | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22413-c54c3ba | |
| Commit | c54c3ba | |
| Direct Download | jetpack-prototype-build-pr22413-c54c3ba.apk |
|
| App Name | WordPress | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22413-c54c3ba | |
| Commit | c54c3ba | |
| Direct Download | wordpress-prototype-build-pr22413-c54c3ba.apk |
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22413 +/- ##
==========================================
- Coverage 39.09% 39.09% -0.01%
==========================================
Files 2207 2207
Lines 106858 106864 +6
Branches 15159 15159
==========================================
+ Hits 41776 41778 +2
- Misses 61566 61570 +4
Partials 3516 3516 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|





Partially addresses CMM-1037
As a companion to this previous PR, this PR updates the page list empty view to remove the outdated illustrations and adds a subtitle to the "Published pages" empty list.
To test, spin up a site without any pages, or delete all the pages in an existing site, and verify the empty views work as expected.
Note that your published page list may shows this homepage item:
If it does, modify this line to just
it.Screen_recording_20251210_131220.mp4