diff --git a/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png b/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png index 072bef08ef7e3..b79c4b316f022 100644 Binary files a/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png and b/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png differ diff --git a/frontend/src/scenes/insights/Insight.tsx b/frontend/src/scenes/insights/Insight.tsx index e782500ebf652..49d71470b3027 100644 --- a/frontend/src/scenes/insights/Insight.tsx +++ b/frontend/src/scenes/insights/Insight.tsx @@ -11,7 +11,7 @@ import { InsightSkeleton } from 'scenes/insights/InsightSkeleton' import { Query } from '~/queries/Query/Query' import { InsightPageHeader } from 'scenes/insights/InsightPageHeader' import { containsHogQLQuery, isInsightVizNode } from '~/queries/utils' - +import { Node } from '~/queries/schema' export interface InsightSceneProps { insightId: InsightShortId | 'new' } @@ -30,6 +30,7 @@ export function Insight({ insightId }: InsightSceneProps): JSX.Element { // insightDataLogic const { query, isQueryBasedInsight, showQueryEditor } = useValues(insightDataLogic(insightProps)) + const { setQuery: setInsightQuery } = useActions(insightDataLogic(insightProps)) // other logics useMountedLogic(insightCommandLogic(insightProps)) @@ -48,6 +49,12 @@ export function Insight({ insightId }: InsightSceneProps): JSX.Element { insightMode === ItemMode.Edit && ((isQueryBasedInsight && !containsHogQLQuery(query)) || (!isQueryBasedInsight && showQueryEditor)) + const setQuery = (query: Node): void => { + if (!isInsightVizNode(query)) { + setInsightQuery(query) + } + } + return (
@@ -57,6 +64,7 @@ export function Insight({ insightId }: InsightSceneProps): JSX.Element { ([ } }, setQuery: ({ query }) => { - if (props.setQuery) { - props.setQuery(query as InsightVizNode) - } - if (isInsightVizNode(query)) { + if (props.setQuery) { + props.setQuery(query as InsightVizNode) + } + const querySource = query.source const filters = queryNodeToFilter(querySource) actions.setFilters(filters)