Skip to content

Commit

Permalink
fix: notebooks nodes (#20265)
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin authored Feb 12, 2024
1 parent adb80e7 commit 53de18d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 9 additions & 1 deletion frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPostHogWidgetNode } from 'scenes/notebooks/Nodes/NodeWrapper'
import { FilterType, NotebookNodeType, RecordingFilters } from '~/types'
import { FilterType, NotebookNodeType, RecordingFilters, ReplayTabs } from '~/types'
import {
SessionRecordingPlaylistLogicProps,
addedAdvancedFilters,
Expand Down Expand Up @@ -165,6 +165,14 @@ export const NotebookNodePlaylist = createPostHogWidgetNode<NotebookNodePlaylist
default: undefined,
},
},
pasteOptions: {
find: urls.replay(ReplayTabs.Recent) + '(.*)',
getAttributes: async (match) => {
const url = new URL(match[0])
const filters = url.searchParams.get('filters')
return { filters: filters ? JSON.parse(filters) : {}, pinned: [] }
},
},
Settings,
})

Expand Down
9 changes: 6 additions & 3 deletions frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const Component = ({
const { expanded } = useValues(nodeLogic)
const { setTitlePlaceholder } = useActions(nodeLogic)
const summarizeInsight = useSummarizeInsight()
const { insightName } = useValues(
insightLogic({ dashboardItemId: query.kind === NodeKind.SavedInsightNode ? query.shortId : 'new' })
)

useEffect(() => {
let title = 'Query'
Expand All @@ -58,13 +61,13 @@ const Component = ({
}
}
}

if (query.kind === NodeKind.SavedInsightNode) {
const logic = insightLogic.findMounted({ dashboardItemId: query.shortId })
title = (logic?.values.insight.name || logic?.values.insight.derived_name) ?? 'Saved Insight'
title = insightName ?? 'Saved Insight'
}

setTitlePlaceholder(title)
}, [query])
}, [query, insightName])

const modifiedQuery = useMemo(() => {
const modifiedQuery = { ...query, full: false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const NotebookNodeRecording = createPostHogWidgetNode<NotebookNodeRecordi
},
},
pasteOptions: {
find: urls.replaySingle('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'),
find: urls.replaySingle('([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'),
getAttributes: async (match) => {
return { id: match[1], noInspector: false }
},
Expand Down

0 comments on commit 53de18d

Please sign in to comment.