Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(surveys): stop the AI side panel auto-opening on survey refresh (#69566)

Sam Pennington6956525ee526
diff --git a/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx b/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx
index b545c3b8ac54..d96821abc173 100644
--- a/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx
+++ b/frontend/src/scenes/surveys/SurveyViewRedesign/SurveyViewRedesign.tsx
@@ -92,7 +92,8 @@ export function SurveyViewRedesign(): JSX.Element {
const { location, searchParams, hashParams } = useValues(router)
const { featureFlags } = useValues(featureFlagLogic)
const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]
- const isInitialSurveyLoad = surveyLoading && survey.id === NEW_SURVEY.id
+ const isUnsavedSurvey = survey.id === NEW_SURVEY.id
+ const isInitialSurveyLoad = surveyLoading && isUnsavedSurvey
const hasMultipleProjects = currentOrganization?.teams && currentOrganization.teams.length > 1
const surveyIdForTransfer = survey?.id && survey.id !== 'new' ? survey.id : null
@@ -169,6 +170,10 @@ export function SurveyViewRedesign(): JSX.Element {
}, [isRemovingSidePanel, openSidePanel, setPanelTab, setScenePanelOpen])
useEffect(() => {
+ if (isUnsavedSurvey) {
+ return
+ }
+
if (!isDraft) {
const autoOpenedSurveyId = autoOpenedDraftPanelForSurveyIdRef.current
if (autoOpenedSurveyId) {
@@ -205,6 +210,7 @@ export function SurveyViewRedesign(): JSX.Element {
}
}, [
isDraft,
+ isUnsavedSurvey,
isRemovingSidePanel,
closeSidePanel,
openSidePanel,