Reader: Migrate useReadFeedSiteQuery to api-core/api-queries#109802
Reader: Migrate useReadFeedSiteQuery to api-core/api-queries#109802gabrielcaires merged 3 commits intotrunkfrom
Conversation
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>
Jetpack Cloud Live (direct link)
Automattic for Agencies Live (direct link)
Dashboard Live (dotcom) (direct link)
|
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
There was a problem hiding this comment.
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
fetchReadFeedSitein@automattic/api-coreand areadFeedSiteQuery()wrapper in@automattic/api-queries. - Updates Reader UI consumers to use
useQuery(readFeedSiteQuery(...))instead ofReader.useReadFeedSiteQuery. - Removes the old
useReadFeedSiteQueryhook and its exports frompackages/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'; | |||
There was a problem hiding this comment.
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.
| export * from './products'; |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Part of READ-410
Proposed Changes
fetchReadFeedSite) intopackages/api-core/src/read-sites/readFeedSiteQuery()query options wrapper inpackages/api-queries/src/read-site.tswpcom-proxy-requestcall with the centralizedwpcomfetcherreader-feed-item,customer-council-banner) to import from the new locationuseReadFeedSiteQueryhook frompackages/data-stores/src/reader/Why are these changes being made?
/read/sites/{id}query to the standardizedapi-core/api-queriespattern, aligning with the ongoing effort to move queries out of Redux/data-stores into React Query with centralized fetchers.Testing Instructions
Pre-merge Checklist