Skip to content

Conversation

@mitoperni
Copy link
Owner

@mitoperni mitoperni commented Feb 9, 2026

Description

Replace unreliable window.history.length check with document.referrer origin comparison for the back button in network detail pages. history.length counts all browser history entries (not just the app's), so router.back() could navigate outside the app when users arrive from external links like Google search results.

Type of Change

  • New feature
  • Bug fix
  • Refactoring
  • Documentation
  • Styling

Changes Made

  • src/components/stations/stations-header.tsx: Replace window.history.length > 1 with document.referrer same-origin check. If the user navigated from within the app, router.back() preserves URL filters. If from external, router.push('/') safely redirects to home.

Screenshots (if applicable)

N/A

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No TypeScript errors
  • Tests added/updated
  • All CI checks pass
  • Tested on different screen sizes
  • Loading states implemented
  • Error handling in place

Related Issues

N/A


Open with Devin

@vercel
Copy link

vercel bot commented Feb 9, 2026

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

Project Deployment Actions Updated (UTC)
cyclemap Ready Ready Preview, Comment Feb 9, 2026 6:49pm

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

@mitoperni mitoperni self-assigned this Feb 9, 2026
@mitoperni
Copy link
Owner Author

Superseded by #62. The document.referrer approach doesn't work for client-side (SPA) navigations in Next.js since it's only updated on full page loads. The new PR uses sessionStorage to track the previous path, which works reliably for both SPA and full-page navigations while also preserving filter/search params.

@mitoperni mitoperni closed this Feb 9, 2026
@mitoperni mitoperni deleted the fix/back-navigation branch February 9, 2026 23:39
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