Skip to content

feat(wallet): add infinite-scroll activity feed + integration test (#677) - #694

Merged
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
khaylebfortune:feat/677-wallet-activity-infinite-scroll
Jul 28, 2026
Merged

feat(wallet): add infinite-scroll activity feed + integration test (#677)#694
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
khaylebfortune:feat/677-wallet-activity-infinite-scroll

Conversation

@khaylebfortune

@khaylebfortune khaylebfortune commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR addresses #677 ("Add integration test for the wallet activity feed loading the next page on scroll"). It introduces the supporting infrastructure for a paginated wallet activity feed and adds the integration test that exercises the full scroll-to-load-next-page flow.

What is new

  • src/services/walletActivity.service.ts (NEW): Extends BaseApiService and exposes walletActivityService plus a thin fetchWalletActivityPage(address, page) wrapper. The wrapper exists so integration tests can vi.spyOn(...) it instead of mocking an axios client, and so the call site stays a plain (address, page) signature.
  • src/components/common/WalletActivityFeed.tsx (NEW): Top-level component that wires the existing useInfiniteScroll sentinel to the new useInfiniteQuery data layer. Aggregates the paginated pages array, deduplicates trades by id (handles overlapping pages returned by a backend paginating by timestamp boundary), and renders the existing TransactionHistory with the accumulated list.
  • src/components/common/__tests__/WalletActivityFeed.infiniteScroll.integration.test.tsx (NEW): Four integration tests that mock IntersectionObserver (capturing callback so the test can drive intersections deterministically) and fetchWalletActivityPage with deterministic two-page data. Each acceptance criterion is asserted by an actual reading of the rendered DOM or the spy call args - none of the assertions are stub-trivial.

What is modified

  • src/hooks/useWallet.ts: useWalletActivity is refactored from useQuery to useInfiniteQuery with initialPageParam: 1 and getNextPageParam: lastPage.nextPage. The query key (queryKeys.wallet.activity(address)) is unchanged, so the existing queryKeyIntegration.test.tsx continues to assert the key correctly without modification.

Acceptance criteria coverage

# Acceptance criterion Where covered
1 Page 1 trades visible on initial load > renders page 1 trades on initial load - asserts @arivers, @schen_dev, @mthorne are present and D/E/F are absent, plus fetchSpy called once with (address, 1).
2 Scroll triggers next page fetch > fetches the next page when the sentinel scrolls into view - registers the MockIntersectionObserver, drives a single isIntersecting: true event via act(), and asserts fetchSpy called a second time with (address, 2).
3 Page 2 trades appended below page 1 trades > appends page 2 trades below page 1 trades after fetching - asserts all six testids are present and the DOM order reads [A, B, C, D, E, F] by iterating container.querySelectorAll(...).
4 No duplicate trades in the combined list > does not render duplicate trade ids when paginated data overlaps - forces an overlap (page 2 repeats C), then asserts each id appears exactly once via getAllByTestId(...).toHaveLength(1) and that the total handle count is 6.

Testing

  • pnpm lint - clean for all touched files (and full repo pass on touched paths)
  • pnpm exec tsc -b - clean (no errors)
  • pnpm vitest run on the new test, the existing queryKeyIntegration test, TransactionHistory.creatorHandle.integration test, and useInfiniteScroll test - 16/16 pass

(New test file: src/components/common/__tests__/WalletActivityFeed.infiniteScroll.integration.test.tsx. Existing pre-existing failures in CreatorCard.accessibility, CopyField, Web3Provider, and lib/web3/format.test.ts were confirmed present on dev prior to this change and are unrelated to #677.)

Checklist

  • Linked issue (Add integration test for the wallet activity feed loading the next page on scroll #677)
  • Scope is limited to the stated change (wallet activity feed infinite scroll + its dedicated integration test)
  • Updated docs if behavior or setup changed - no docs change needed; behaviour is internal to the component
  • Added screenshots for UI changes when relevant - this PR is test-only; no rendered UI change yet (the component is introduced as a unit but not wired into a route)

closes #677

…yerorg#677)

Adds the supporting infrastructure for a paginated wallet activity feed
and the integration test that verifies it loads older trades as the user
scrolls.

* src/services/walletActivity.service.ts (NEW): exposes
  fetchWalletActivityPage so React Query useInfiniteQuery can fetch
  per-page activity for a wallet address; cacheManager-backed.
* src/hooks/useWallet.ts (MODIFIED): useWalletActivity now uses
  useInfiniteQuery with initialPageParam=1 and getNextPageParam wired
  to lastPage.nextPage. Query key (queryKeys.wallet.activity(address))
  is unchanged so the existing queryKeyIntegration.test.tsx continues to
  pass.
* src/components/common/WalletActivityFeed.tsx (NEW): aggregates
  useInfiniteQuery pages, deduplicates trades by id, renders existing
  TransactionHistory with the accumulated list, and drives a sentinel
  via useInfiniteScroll to trigger fetchNextPage when the bottom of the
  feed scrolls into view.
* src/components/common/__tests__/WalletActivityFeed.infiniteScroll.
  integration.test.tsx (NEW): four integration tests covering acceptance
  criteria - page 1 visible on initial load, scroll triggers next page
  fetch, page 2 appended below page 1, no duplicate trades when pages
  overlap.
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@khaylebfortune Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit c851076 into accesslayerorg:dev Jul 28, 2026
1 check passed
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.

Add integration test for the wallet activity feed loading the next page on scroll

2 participants