Skip to content

WS-2563 UAS: Update My News page to use TanStack Query with pagination#14054

Open
elvinasv wants to merge 10 commits into
latestfrom
WS-2563-uas-my-news-page-to-use-tan-stack-query-with-pagination
Open

WS-2563 UAS: Update My News page to use TanStack Query with pagination#14054
elvinasv wants to merge 10 commits into
latestfrom
WS-2563-uas-my-news-page-to-use-tan-stack-query-with-pagination

Conversation

@elvinasv
Copy link
Copy Markdown
Member

@elvinasv elvinasv commented May 21, 2026

Resolves JIRA: https://bbc.atlassian.net/browse/WS-2563

Summary

  • Use TanStack Query to fetch saved resources
  • Update the structure to utilize lazy loading
Screenshot 2026-05-21 at 15 23 11

Testing

Useful Links

Copy link
Copy Markdown
Member Author

@elvinasv elvinasv May 21, 2026

Choose a reason for hiding this comment

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

Note: Using the existing MyNewsPage with small tweaks. The UX is out of scope of this task

@elvinasv elvinasv changed the title feat: update my news with tanstack query WS-2563 UAS: Update My News page to use TanStack Query with pagination May 21, 2026
@elvinasv elvinasv marked this pull request as ready for review May 21, 2026 13:18
Copilot AI review requested due to automatic review settings May 21, 2026 13:18
@elvinasv elvinasv self-assigned this May 21, 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

This PR refactors the WS Next.js My News page to fetch UAS saved resources using TanStack Query and to restructure rendering via lazy-loaded client-only content (including pagination support).

Changes:

  • Introduces a new MyNewsPage component structure (MyNewsPage/ folder) with separate loading/guest/content components and client-only lazy loading.
  • Migrates useUASRecentActivity from useEffect/local state to @tanstack/react-query with new UAS query keys.
  • Updates SSR props to pass the page query param through to the client for pagination.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ws-nextjs-app/pages/[service]/my-news/types.ts Adds My News page prop typing used by the new component structure.
ws-nextjs-app/pages/[service]/my-news/styles.ts Removes the old empty state styling used by the deleted implementation.
ws-nextjs-app/pages/[service]/my-news/MyNewsPage/MyNewsPageLoading.tsx Adds a loading placeholder component for lazy-loaded content.
ws-nextjs-app/pages/[service]/my-news/MyNewsPage/MyNewsPageGuest.tsx Adds a guest placeholder component when personalization is disabled.
ws-nextjs-app/pages/[service]/my-news/MyNewsPage/MyNewsPageContent.tsx Implements client-side fetching + pagination rendering using useUASRecentActivity.
ws-nextjs-app/pages/[service]/my-news/MyNewsPage/index.tsx New wrapper page that gates on AccountContext and lazy-loads content.
ws-nextjs-app/pages/[service]/my-news/MyNewsPage/index.test.tsx Updates import to new entrypoint (tests require further updates).
ws-nextjs-app/pages/[service]/my-news/MyNewsPage.tsx Removes the previous all-in-one My News page implementation.
ws-nextjs-app/pages/[service]/my-news/index.page.tsx Passes page query param into SSR props for the new pagination flow.
src/app/lib/uasApi/queryKeys.ts Adds a React Query key helper for paged favourites.
src/app/lib/uasApi/getRecentActivity.ts Extracts and exports a RecentActivityData type for hook/tests.
src/app/hooks/useUASRecentActivity/index.ts Migrates recent activity fetching to TanStack Query.
src/app/hooks/useUASRecentActivity/index.test.ts Rewrites tests to validate React Query configuration and behavior.
Comments suppressed due to low confidence (1)

ws-nextjs-app/pages/[service]/my-news/MyNewsPage/index.test.tsx:9

  • After switching the component entrypoint to . (and moving logic into the new MyNewsPage/dynamic content components), these tests need their setup updated: MyNewsPage now depends on AccountContext (personalization availability/enabled) and the mocked useUASRecentActivity return type/UI copy have changed (e.g. error is now Error | null, and empty/error messages differ). As written, the default providers (idctaConfig is null) will cause the page to return null and assertions will fail.

Comment thread ws-nextjs-app/pages/[service]/my-news/MyNewsPage/MyNewsPageContent.tsx Outdated
Comment thread src/app/lib/uasApi/queryKeys.ts
Comment thread ws-nextjs-app/pages/[service]/my-news/types.ts Outdated
Comment thread ws-nextjs-app/pages/[service]/my-news/MyNewsPage/index.tsx
Copy link
Copy Markdown
Contributor

@jinidev jinidev left a comment

Choose a reason for hiding this comment

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

Looks good and tested all scenarios including analytics , working fine.

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.

4 participants