Resolve the comment moderation capability through one shared resolver - #25980
Conversation
The detail screen awaited the moderation capability before it could render its toolbar and nav bar controls, so they missed the first frame and appeared after the push transition. CommentsCapabilityResolver now owns the lookup: the router prefetches it once while the list loads and caches the answer, and each detail view model seeds from that cached value so its controls render on the first frame, then awaits it on load. The lookup throws so a failure is never cached; it retries on the next open and degrades the screen to read-only.
Generated by 🚫 Danger |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 34251 | |
| Version | PR #25980 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 1b59c06 | |
| Installation URL | 08pp1k1u9ngt0 |
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 34251 | |
| Version | PR #25980 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 1b59c06 | |
| Installation URL | 6cfccra7bfc8g |
jkmassel
left a comment
There was a problem hiding this comment.
This works well for me on-device, though the "Approve" and "In reply to" UI elements still pop in a moment later.
One nit, but I couldn't repro it – would the spam/trash buttons show up on the "couldn't load the comment" error screen/
|
Sorry – another question – should we resolve the user's capabilities earlier (like at the site root), then cache them for future requests so we don't need to check over and over? |
I believe they'll show up, but in disabled state.
They are cached, at the WordPressClient actor. However, since it's an actor, we won't be able to get the cached value synchronously. The |


Description
The comment detail screen awaited the moderation capability before it could render its toolbar and nav bar controls, so they missed the first frame and popped in only after the push transition finished.
CommentsCapabilityResolvernow owns the lookup. The router prefetches it once while the list loads and caches the result, and eachCommentDetailViewModelseeds from that cached value so its controls render on the first frame, then still awaits the resolver on load. The lookup throws rather than caching a failure, so it retries on the next open and degrades the screen to read-only in the meantime.This PR also switches the Spam action to the octagon glyph.
Testing instructions
Open a comment from the list and confirm the moderation toolbar and nav bar controls are present as the detail screen appears, with no pop-in after the push transition.