Skip to content

Fix: update blog count in pill on site block - #23290

Open
coderGtm wants to merge 1 commit into
wordpress-mobile:trunkfrom
coderGtm:fix/blog-count-refresh
Open

Fix: update blog count in pill on site block#23290
coderGtm wants to merge 1 commit into
wordpress-mobile:trunkfrom
coderGtm:fix/blog-count-refresh

Conversation

@coderGtm

@coderGtm coderGtm commented Sep 3, 2026

Copy link
Copy Markdown

Description

Fixes #21146. In Reader → Subscriptions, blocking a site via the post overflow menu ("Block this site") hid the post but left the "N Blog" filter pill showing a stale count until pull-to-refresh.

The pill count (blogsFilterCount in ReaderViewModel.TopBarUiState) is recomputed only when SubFilterViewModel.subFilters re-emits, which happens solely when the ReaderEvents.FollowedBlogsFetched event is posted — previously only by ReaderUpdateLogic during a full tags/blogs sync (the pull-to-refresh path). The block flow refreshed the posts adapter and mutated the DB but never emitted this event.

This PR makes handleBlockSiteClicked emit FollowedBlogsFetched (with the fresh count from ReaderBlogTableWrapper.getFollowedBlogs()) after every DB mutation: on local block, on snackbar undo, and on RequestFailed (whose failure path re-follows the blog). The pill now updates immediately to "0 Blogs".

Testing instructions

Blocking a site in the Subscriptions tab:

  1. Open the Reader and navigate to Subscriptions.
  2. Tap the '...' overflow menu on a post.
  3. Select 'Block this site'.
  • The post disappears from the list immediately.
  • The filter pill count decreases by one (e.g. "1 Blog" → "0 Blogs") immediately, without pulling to refresh.

Undoing a blocked site:

  1. In Subscriptions, block a site via the '...' overflow menu.
  2. Tap 'Undo' on the snackbar.
  • The posts are restored and the filter pill count increases back to the previous value immediately.

Blocking a site fails (no network / request failure):

  1. In Subscriptions with the device offline (or against a failing endpoint), block a site via the '...' overflow menu.
  • The error snackbar appears and the filter pill count reflects the actual followed-blog state (restored on request failure, since the blog is re-followed).

Regression check — other Reader entry points:

  1. From a post in Discover or a post detail screen, block a site.
  • The action still works and the Subscriptions filter pill count stays consistent with the followed-blog state once revisited, with no crash or double-refresh.

Screen recording

Screen_recording_20260903_174715.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After blocking a site, the filter pill updates the number only after manually refreshing the page.

1 participant