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): record file system view from survey scene root (#57639)

Adam Leith368d3e62f210
diff --git a/frontend/src/scenes/surveys/Survey.tsx b/frontend/src/scenes/surveys/Survey.tsx
index b21fec7690f3..4534985dcc39 100644
--- a/frontend/src/scenes/surveys/Survey.tsx
+++ b/frontend/src/scenes/surveys/Survey.tsx
@@ -6,6 +6,7 @@ import { LemonDivider, LemonTag, Link, lemonToast } from '@posthog/lemon-ui'
import { FlagSelector } from 'lib/components/FlagSelector'
import { NotFound } from 'lib/components/NotFound'
+import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { featureFlagLogic } from 'scenes/feature-flags/featureFlagLogic'
import { FeatureFlagReleaseConditions } from 'scenes/feature-flags/FeatureFlagReleaseConditions'
@@ -28,7 +29,15 @@ export const scene: SceneExport<SurveyLogicProps> = {
export function SurveyComponent({ id }: SurveyLogicProps): JSX.Element {
const { editingSurvey, setSelectedPageIndex, loadSurvey } = useActions(surveyLogic)
- const { isEditingSurvey, surveyMissing } = useValues(surveyLogic)
+ const { isEditingSurvey, surveyMissing, survey } = useValues(surveyLogic)
+
+ const surveyId = survey?.id && survey.id !== 'new' ? survey.id : null
+
+ useFileSystemLogView({
+ type: 'survey',
+ ref: surveyId,
+ enabled: Boolean(surveyId),
+ })
// register tool so edits from AI will always reload the survey data on-page
useMaxTool({
diff --git a/frontend/src/scenes/surveys/SurveyView.tsx b/frontend/src/scenes/surveys/SurveyView.tsx
index d8ae958aa7d2..e62961433ff2 100644
--- a/frontend/src/scenes/surveys/SurveyView.tsx
+++ b/frontend/src/scenes/surveys/SurveyView.tsx
@@ -20,7 +20,6 @@ import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { SceneDuplicate } from 'lib/components/Scenes/SceneDuplicate'
import { SceneFile } from 'lib/components/Scenes/SceneFile'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
-import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
@@ -116,12 +115,6 @@ function SurveyViewLegacy({ id }: { id: string }): JSX.Element {
const surveyId = survey?.id && survey.id !== 'new' ? survey.id : null
- useFileSystemLogView({
- type: 'survey',
- ref: surveyId,
- enabled: Boolean(surveyId && !isInitialSurveyLoad),
- })
-
useEffect(() => {
if (survey.start_date) {
setTabKey('results')