posthog icon indicating copy to clipboard operation
posthog copied to clipboard

bug(survey): Going back after pressing `explore results` does not bring me back to survey's page

Open lshaowei18 opened this issue 6 months ago • 2 comments

Bug Description

https://github.com/user-attachments/assets/3f9c124a-62cc-48c8-be06-267a0c5f5b1f

How to reproduce

  1. Have a survey that has a response.
  2. Click on Explore Results on the survey page
  3. Click on the browser back button multiple times
  4. Unable to navigate back to the survey

Additional context

I tried only on chrome so far and only 1 survey.

Debug info

- [x] PostHog Cloud, Debug information:
Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/019723bd-c6d8-7157-a566-734755227b85?t=2153
Admin: http://go/adminOrgUS/0196b42e-7da5-0000-5ebf-394ff456f41d (project ID 162378)

lshaowei18 avatar May 31 '25 01:05 lshaowei18

Some additional context:

I noticed that this bug happens only if the leave insight window alert is shown. If the leave insight alert isn't shown, the back button will go back to the correct url.

The window alert logic is in:

https://github.com/PostHog/posthog/blob/3370261c0ad9599b67a60fe2402513ef3fe8d98b/frontend/src/scenes/insights/insightSceneLogic.tsx#L395-L443

It seems like when confirm is clicked, the url is replaced:

https://github.com/user-attachments/assets/5de0d977-bfc7-4bbe-89fa-7da15a514149

Clicking on cancel will result in the alert to always show, and you can see that the url is constantly being replaced:

https://github.com/user-attachments/assets/43cc1781-c445-4013-abed-81da7fd45938

lshaowei18 avatar Jun 08 '25 01:06 lshaowei18

Hey @lshaowei18 thanks for your issue and PR! This is indeed a painful bug in the common browser UX.

I'll take a look on your code by Tuesday at most, and we can work together to get it merged

lucasheriques avatar Jun 16 '25 04:06 lucasheriques