Improve error handling in RS post list#22633
Conversation
Add three-dot overflow menu to each post card with status-aware actions: Published/Private posts get View, Read, Move to Draft, Duplicate, Share, Blaze, Stats, Comments, and Trash. Draft/Pending/Scheduled posts get Duplicate and Trash. Trashed posts get Move to Draft and Delete Permanently. Navigation actions (View, Read, Share, Stats, Comments, Blaze) are fully wired to launch the appropriate activities. Mutation actions (Move to Draft, Duplicate, Trash, Delete) are UI-only no-ops that will be connected to wordpress-rs networking in a follow-up PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…king Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Group confirmation dialog callbacks into ConfirmationDialogState data class, reducing PostRsListScreen from 19 to 15 parameters - Extract TrashConfirmationDialog and DeleteConfirmationDialog composables - Add TODO for findPost() linear scan optimization - Fix import ordering for uniffi.wp_api.PostStatus - Remove unused featuredImageId field from PostRsUiModel Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…atching Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace "Not implemented yet" placeholders with actual API calls for Trash, Delete Permanently, Publish, Move to Draft, and Duplicate actions using wordpress-rs (no FluxC). After each successful mutation all initialized tab collections are refreshed so the list updates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The duplicate networking (fetching + creating on server) is deferred to a later branch so the approach can be revisited. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Optimistically remove the post from local tab state on success so Compose's animateItem() can fade it out and smoothly slide remaining items up, instead of the list jumping instantly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused post_rs_duplicated and post_rs_error_duplicate strings - Consolidate ShowError into ShowToast (both showed a toast) - Make ConfirmationDialogState a data class - Remove trailing blank line in PostRsRestClient Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of checking getSelectedSite() in 6 different places with inconsistent null-handling patterns, store the site at construction time and send Finish event (with toast) if no site is selected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace defensive val site = site ?: return with site!! since the Activity finishes on init when site is null. Consolidate two postStore.getPostByRemotePostId calls into a getFluxCPost helper that shows a toast when the post isn't found. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use a private _site backing field with a non-null site getter that calls requireNotNull with a descriptive message. This eliminates 14 uses of site!! and provides a clear error if site is accessed after the Activity should have finished. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adapt to API change: WpSelfHostedService replaced by WpService with factory method, ApiUrlResolver parameter removed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename WpSelfHostedServiceProvider to WpServiceProvider and add WP.com support using WpService.wordpressCom() with bearer token auth. Update PostRsRestClient to route WP.com post mutations through the WP.com REST API proxy. Update ActivityLauncher gateway to allow WP.com sites when the RS post list experimental feature is enabled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove "self-hosted" qualifier since the feature now supports all sites with application passwords. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Simplify the RS post list gateway to require hasApplicationPassword() for all sites, matching the feature description. Cache WP.com WpApiClient instances by siteId to avoid recreating them on every mutation call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Network errors from wordpress-rs surface verbose internal messages like "UniffiWpApiException$RequestExecutionFailed..." to the user. Replace all raw e.message / listInfo.errorMessage usage with a helper that checks network state and returns the appropriate user-facing string. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The error screen title and subtitle were both "An error occurred". Now the subtitle gives actionable context: a network-specific message when offline, or a generic request failure message otherwise. The subtitle text is also center-aligned to match the title. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Flip any SIMULATE_*_ERROR constant to true to trigger that error path. Remove before merging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generated by 🚫 Danger |
|
|
|
|
Inspect WpApiException subtypes to distinguish offline, auth, and generic errors. Invalid or revoked application passwords now show "Your authentication has expired. Please sign in again." instead of the generic request failure message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Throws a WpApiException with HttpAuthenticationRejectedError to verify the "Your authentication has expired" message appears. Remove before merging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The friendly error messages weren't matching specific error types because exceptions are now wrapped in FetchException.Api. Unwrap the inner WpApiException before checking for auth errors, offline status, and other specific error codes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22633 +/- ##
==========================================
- Coverage 38.15% 38.12% -0.03%
==========================================
Files 2263 2263
Lines 115731 115813 +82
Branches 16073 16093 +20
==========================================
Hits 44157 44157
- Misses 67949 68031 +82
Partials 3625 3625 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Shouldn't we hide the "Retry" button in this case?
In this case, the first loading doesn't work either. I directly see a "There was a problem handling the request" screen. |
adalpari
left a comment
There was a problem hiding this comment.
Nice improvement!!
I just left a couple of comments, but I don't think they are blocking the PR.
Auth failures won't resolve by retrying, so suppress the retry action in both the full-screen error state and snackbar messages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Good call, I added this in 4f674f8. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|





Description
Replaces silent failures and low-visibility Toasts with Snackbars (with optional retry actions) and adds a retry button to the full-screen error state. Raw wordpress-rs exception messages are no longer surfaced to users — instead, the error type is inspected to show context-specific messages for offline, authentication, and generic failures.
Before / After
Test simulation toggles (removed)
In PostRsListViewModel.kt companion object, flip any constant to true to trigger that error path:
Testing instructions
Test with simulation toggles:
Set SIMULATE_INIT_ERROR = true, build and open the post list
Set SIMULATE_AUTH_ERROR = true (others false), build and open the post list
Set SIMULATE_REFRESH_ERROR = true (others false), build and open the post list
Set SIMULATE_LOAD_MORE_ERROR = true (others false), build and open the post list on a site with >20 posts
Set SIMULATE_ACTION_ERROR = true (others false), build and open the post list
Test with airplane mode:
Enable airplane mode, open the post list
Open the post list normally, then enable airplane mode and pull to refresh