Skip to content

Reader: Migrate useReadFeedSiteQuery to api-core/api-queries#109802

Merged
gabrielcaires merged 3 commits intotrunkfrom
update/reader-migrate-read-site-info
Apr 3, 2026
Merged

Reader: Migrate useReadFeedSiteQuery to api-core/api-queries#109802
gabrielcaires merged 3 commits intotrunkfrom
update/reader-migrate-read-site-info

Conversation

@gabrielcaires
Copy link
Copy Markdown
Contributor

Part of READ-410

Proposed Changes

  • Extract pure fetcher function (fetchReadFeedSite) into packages/api-core/src/read-sites/
  • Create readFeedSiteQuery() query options wrapper in packages/api-queries/src/read-site.ts
  • Replace direct wpcom-proxy-request call with the centralized wpcom fetcher
  • Update consumers (reader-feed-item, customer-council-banner) to import from the new location
  • Remove old useReadFeedSiteQuery hook from packages/data-stores/src/reader/

Why are these changes being made?

  • This migrates the /read/sites/{id} query to the standardized api-core / api-queries pattern, aligning with the ongoing effort to move queries out of Redux/data-stores into React Query with centralized fetchers.

Testing Instructions

  • Verify the Reader feed item component still loads site info correctly (icon, description, URL) for WPCOM feeds in the subscriptions search results.
  • Verify the Customer Council banner in the Reader stream still checks subscription status correctly.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

Move the read site info hook from data-stores to the standardized
api-core/api-queries pattern, replacing direct wpcom-proxy-request
with the centralized wpcom fetcher.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@matticbot
Copy link
Copy Markdown
Contributor

matticbot commented Apr 2, 2026

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • help-center

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/reader-migrate-read-site-info on your sandbox.

@gabrielcaires gabrielcaires requested a review from Copilot April 2, 2026 11:05
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the Reader /read/sites/{id} data fetching from the data-stores hook into the standardized api-core (fetcher) + api-queries (React Query options) pattern as part of READ-410.

Changes:

  • Introduces fetchReadFeedSite in @automattic/api-core and a readFeedSiteQuery() wrapper in @automattic/api-queries.
  • Updates Reader UI consumers to use useQuery(readFeedSiteQuery(...)) instead of Reader.useReadFeedSiteQuery.
  • Removes the old useReadFeedSiteQuery hook and its exports from packages/data-stores.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/data-stores/src/reader/queries/use-read-feed-site-query.ts Removes the legacy React Query hook backed by wpcomRequest.
packages/data-stores/src/reader/queries/index.ts Stops exporting the removed hook.
packages/data-stores/src/reader/index.ts Removes top-level export of the removed hook.
packages/api-queries/src/read-site.ts Adds readFeedSiteQuery() query-options wrapper for React Query.
packages/api-queries/src/index.ts Re-exports read-site query helper.
packages/api-core/src/read-sites/types.ts Adds ReadFeedSiteResponse type for the endpoint response.
packages/api-core/src/read-sites/index.ts Exposes read-sites fetchers/types from the module barrel.
packages/api-core/src/read-sites/fetchers.ts Adds centralized fetchReadFeedSite fetcher using wpcom.req.get.
packages/api-core/src/index.ts Re-exports read-sites from the package entrypoint.
client/reader/stream/customer-council-banner.jsx Switches to useQuery(readFeedSiteQuery(...)) for subscription status check.
client/blocks/reader-feed-item/index.tsx Switches to useQuery(readFeedSiteQuery(...)) for WPCOM feed site info.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -74,6 +74,7 @@ export * from './products';
export * from './products';
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

packages/api-core/src/index.ts currently exports ./products twice (two identical export * from './products'; lines). Since this PR is already touching the barrel in this area (adding ./read-sites), it’s a good opportunity to drop the duplicate export to keep the entrypoint clean and avoid confusion about where exports come from.

Suggested change
export * from './products';

Copilot uses AI. Check for mistakes.
@gabrielcaires gabrielcaires marked this pull request as ready for review April 3, 2026 20:29
@gabrielcaires gabrielcaires requested a review from a team as a code owner April 3, 2026 20:29
@gabrielcaires gabrielcaires merged commit e3b023e into trunk Apr 3, 2026
14 checks passed
@gabrielcaires gabrielcaires deleted the update/reader-migrate-read-site-info branch April 3, 2026 20:29
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 3, 2026
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.

3 participants