fix: Back button sends user to external site when landing directly on a product URL #5

Closed
opened 2026-05-18 11:30:04 +05:30 by starkSV · 0 comments
starkSV commented 2026-05-18 11:30:04 +05:30 (Migrated from github.com)

Bug

When a user arrives at a product page directly from an external source
(Google, Reddit, etc.) and clicks ← Back, they are sent back to that
external site instead of the app home page.

Root cause

The Back button uses React Router's navigate(-1), which moves one step
back in the browser history stack. If the previous entry is an external
page, that's where it goes.

File: frontend/src/pages/ProductDetailPage.tsx, line 216

Expected behavior

Back should always land on / if there is no prior in-app history.

Fix

onClick={() => navigate(window.history.state?.idx ? -1 : '/')}

Steps to reproduce

  1. Open a product URL directly (e.g. from a Google search result)
  2. Click ← Back
  3. Observe: browser navigates to the external referrer, not the home page
## Bug When a user arrives at a product page directly from an external source (Google, Reddit, etc.) and clicks ← Back, they are sent back to that external site instead of the app home page. ## Root cause The Back button uses React Router's `navigate(-1)`, which moves one step back in the browser history stack. If the previous entry is an external page, that's where it goes. **File:** `frontend/src/pages/ProductDetailPage.tsx`, line 216 ## Expected behavior Back should always land on `/` if there is no prior in-app history. ## Fix ```tsx onClick={() => navigate(window.history.state?.idx ? -1 : '/')} ``` ## Steps to reproduce 1. Open a product URL directly (e.g. from a Google search result) 2. Click ← Back 3. Observe: browser navigates to the external referrer, not the home page
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: shekhar/windows-iso-downloader#5
No description provided.