Skip to content

fix: case studies filter tabs no longer break back button#4896

Open
rahulhgdev wants to merge 1 commit into
neondatabase:mainfrom
rahulhgdev:fix/case-studies-back-navigation
Open

fix: case studies filter tabs no longer break back button#4896
rahulhgdev wants to merge 1 commit into
neondatabase:mainfrom
rahulhgdev:fix/case-studies-back-navigation

Conversation

@rahulhgdev
Copy link
Copy Markdown

@rahulhgdev rahulhgdev commented May 11, 2026

What's the problem?

Clicking category filters on the case studies page was adding a new browser history entry each time. So if you clicked through a few filters and opened an article, the back button would take you through every filter you'd clicked instead of just going back to the page.

Case.Studies.Neon.mp4

Steps to reproduce

  1. Go to https://neon.com/case-studies
  2. Click a few filters - Startups, Fast-moving teams, AI Agents
  3. Open any article
  4. Hit back

Before: article → #ai-agents → #fast-moving-teams → #startups → /case-studies
After: article → /case-studies

What's the fix?

When a filter is clicked, instead of letting the browser push a new history entry, we now replace the current one using replaceState. The URL still updates so deep-linking and sharing still work - the back button just behaves correctly now.

Also added a popstate listener alongside the existing hashchange one. Without it, hitting back from an article wouldn't sync the active filter with the URL since back navigation fires popstate, not hashchange.

File changed

src/components/pages/case-studies/cards/cards.jsx

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

@rahulhgdev is attempting to deploy a commit to the neondatabase Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant