Skip to content

fix(explore): reset scroll position when category filter changes - #887

Open
Rafiat30 wants to merge 4 commits into
Iris-IV:mainfrom
Rafiat30:fix/explore-category-scroll-reset
Open

fix(explore): reset scroll position when category filter changes#887
Rafiat30 wants to merge 4 commits into
Iris-IV:mainfrom
Rafiat30:fix/explore-category-scroll-reset

Conversation

@Rafiat30

Copy link
Copy Markdown
Contributor

Closes #561

Summary

ExploreClient.tsx has no search box, URL params, or cursor-based pagination — it's a client-side category-pill filter over useCampaigns(). The pagination/cursor reset issue as originally described actually lives against CausesClient.tsx, which already resets its page state (visibleCount) on every filter change. The remaining gap in ExploreClient was UX-adjacent: switching categories didn't reset scroll position, so users could be left stranded deep in a now-stale list.

Changes

  • Modified: src/app/[locale]/explore/ExploreClient.tsx — scrolls back to the top of the page whenever activeCategory changes.

How to test

  1. Run the app, go to /explore.
  2. Scroll down the campaign list.
  3. Click a different category pill.
  4. Confirm the page scrolls back to the top instead of staying at the previous offset.
  5. npm run typecheck

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Rafiat30 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

@sshdopey

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

1 similar comment
@sshdopey

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

@davidmaronio

Copy link
Copy Markdown
Contributor

good investigation in the PR body (correctly identifying that the original issue text pointed at CausesClient), and the fix plus the integration test with the userEvent flow is tidy. one small ask, non-blocking:

  1. src/app/[locale]/explore/ExploreClient.tsx:31: the effect also fires on initial mount (your test mockClears around it), which can fight the browser's scroll restoration when navigating back to /explore. a first-run ref skip would limit the scroll to actual category changes.

gate: branch is behind main; rebase and rerun CI, then good to merge.

Switching the active category previously left the viewport at its
prior scroll offset, which could strand users deep in a now-stale
list. Scroll back to the top whenever activeCategory changes.

Refs Iris-IV#561
Adds regression coverage for the scroll-to-top-on-category-change fix:
confirms window.scrollTo({ top: 0 }) fires when the active category changes
and the filtered list updates, and confirms it does not fire again for a
re-click of the already-active category (no-op state change).

Refs Iris-IV#561
The scroll-reset effect fired on first render as well as on actual
category changes, which could fight the browser's scroll restoration
when navigating back to /explore. Skip the first run with a ref so it
only fires on real category changes.
- Format useMultiSigProposals.test.tsx (Prettier check was failing on it)
- Add missing Causes.listView/mapView translation keys (en, es) — the
  view-toggle buttons on /causes reference these keys but they were
  never added, so next-intl throws MISSING_MESSAGE and the Playwright
  smoke test fails when it navigates through that page
- Add the missing getAllCampaigns mock to the AppPageComponents
  contractClient mock, and cover the two HomeClient stats/CTA branches
  that were never exercised as a result (queryFn was undefined, so
  the stats panel and the wallet-connecting CTA state never rendered)

None of this is related to this branch's actual change; main's CI
was already failing on all three checks before this branch rebased
onto it.
@Rafiat30
Rafiat30 force-pushed the fix/explore-category-scroll-reset branch from 9faeace to 5ebecd0 Compare August 5, 2026 14:16
@sshdopey

sshdopey commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

@Rafiat30

Rafiat30 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@ogazboiz pls help review. i have fixed every issue

@davidmaronio

Copy link
Copy Markdown
Contributor

this is verified and approved, but today's merge wave put the branch into conflict before it reached the front of the queue (lots of prs touching the same i18n and test files landed at once). please rebase onto current main and push, i'll merge as soon as it's green, no re-review needed.

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.

[Bug] ExploreClient search filter resets pagination to page 1 but URL cursor param is not cleared

3 participants