Skip to content

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

Merged
philip merged 2 commits into
neondatabase:mainfrom
rahulhgdev:fix/case-studies-back-navigation
Jun 30, 2026
Merged

fix: case studies filter tabs no longer break back button#4896
philip merged 2 commits into
neondatabase:mainfrom
rahulhgdev:fix/case-studies-back-navigation

Conversation

@rahulhgdev

@rahulhgdev rahulhgdev commented May 11, 2026

Copy link
Copy Markdown
Contributor

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

vercel Bot commented May 11, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
neon-next Error Error Jun 30, 2026 3:15am

Request Review

philip and others added 2 commits June 29, 2026 20:00
dynamicParams=false prevents crashes when bots/bookmarks hit
slugs not in generateStaticParams. Redirects map 11 pages
removed in neondatabase#4374 to their replacements.
@philip philip force-pushed the fix/case-studies-back-navigation branch from 6ef95a5 to 519ab39 Compare June 30, 2026 03:13
@philip philip merged commit 3cf2baa into neondatabase:main Jun 30, 2026
1 check failed
@philip

philip commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks @rahulhgdev for the fix!

(also, sorry, Claude and I caused chaos in your PR; AGI isn't here yet...)

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.

2 participants