Skip to content

Resolve the comment moderation capability through one shared resolver - #25980

Merged
crazytonyli merged 2 commits into
trunkfrom
task/comments-v2-m3-moderation-polish
Sep 2, 2026
Merged

Resolve the comment moderation capability through one shared resolver#25980
crazytonyli merged 2 commits into
trunkfrom
task/comments-v2-m3-moderation-polish

Conversation

@crazytonyli

@crazytonyli crazytonyli commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

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.

CommentsCapabilityResolver now owns the lookup. The router prefetches it once while the list loads and caches the result, and each CommentDetailViewModel seeds 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.

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.
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@crazytonyli crazytonyli changed the title task/comments v2 m3 moderation polish Resolve the comment moderation capability through one shared resolver Sep 2, 2026
@crazytonyli
crazytonyli requested a review from jkmassel September 2, 2026 09:30
@crazytonyli crazytonyli added this to the 27.3 milestone Sep 2, 2026
@crazytonyli
crazytonyli marked this pull request as ready for review September 2, 2026 09:30
@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number34251
VersionPR #25980
Bundle IDorg.wordpress.alpha
Commit1b59c06
Installation URL08pp1k1u9ngt0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number34251
VersionPR #25980
Bundle IDcom.jetpack.alpha
Commit1b59c06
Installation URL6cfccra7bfc8g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jkmassel jkmassel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/

@jkmassel

jkmassel commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

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?

@crazytonyli

Copy link
Copy Markdown
Contributor Author

would the spam/trash buttons show up on the "couldn't load the comment" error screen/

I believe they'll show up, but in disabled state.

should we resolve the user's capabilities earlier (like at the site root), then cache them

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 canModeration = ... line in this PR is the real change that makes the Reply button shows up immediately.

@crazytonyli
crazytonyli added this pull request to the merge queue Sep 2, 2026
Merged via the queue into trunk with commit d587680 Sep 2, 2026
30 checks passed
@crazytonyli
crazytonyli deleted the task/comments-v2-m3-moderation-polish branch September 2, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants