Skip to content

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

Open
Rafiat30 wants to merge 2 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 2 commits into
Iris-IV:mainfrom
Rafiat30:fix/explore-category-scroll-reset

Conversation

@Rafiat30

Copy link
Copy Markdown

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

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

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

Copy link
Copy Markdown
Contributor

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

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

2 participants