Skip to content

Commit

Permalink
fix: show correct badge count on notebook button
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin committed Oct 3, 2023
1 parent b9e358c commit 96338f8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions frontend/src/scenes/insights/InsightPageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import { AddToDashboardModal } from 'lib/components/AddToDashboard/AddToDashboar
import { useState } from 'react'
import { NewDashboardModal } from 'scenes/dashboard/NewDashboardModal'
import { NotebookSelectButton } from 'scenes/notebooks/NotebookSelectButton/NotebookSelectButton'
import { NodeKind } from '~/queries/schema'

export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: InsightLogicProps }): JSX.Element {
// insightSceneLogic
Expand Down Expand Up @@ -259,10 +258,8 @@ export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: In
<>
<NotebookSelectButton
resource={{
attrs: {
query: { kind: NodeKind.SavedInsightNode, shortId: insight.short_id },
},
type: NotebookNodeType.Query,
attrs: { id: insight.short_id },
}}
type="secondary"
/>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/scenes/notebooks/Notebook/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export const textContent = (node: any): string => {
'ph-feature-flag': customOrTitleSerializer,
'ph-feature-flag-code-example': customOrTitleSerializer,
'ph-image': customOrTitleSerializer,
'ph-insight': customOrTitleSerializer,
'ph-person': customOrTitleSerializer,
'ph-query': customOrTitleSerializer,
'ph-recording': customOrTitleSerializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function NotebookSelectList(props: NotebookSelectProps): JSX.Element {

return (
<div className="space-y-2 flex flex-col flex-1 h-full overflow-hidden">
<div className="border-b space-y-2 flex-0">
<div className="border-b space-y-2 flex-0 pb-2">
<LemonInput
type="search"
placeholder="Search notebooks..."
Expand Down
1 change: 0 additions & 1 deletion frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3041,7 +3041,6 @@ export type NotebookType = NotebookListItemType & {
}

export enum NotebookNodeType {
Insight = 'ph-insight',
Query = 'ph-query',
Recording = 'ph-recording',
RecordingPlaylist = 'ph-recording-playlist',
Expand Down
2 changes: 2 additions & 0 deletions posthog/api/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ def _filter_request(self, request: request.Request, queryset: QuerySet) -> Query
# replay timestamps are not at the top level, they're one-level down in a content array
presence_match_structure = [{"content": [{"type": f"ph-{target}"}]}]
id_match_structure = [{"content": [{"attrs": {"sessionRecordingId": match}}]}]
elif target == "query":
id_match_structure = [{"attrs": {"query": {"kind": "SavedInsightNode", "shortId": match}}}]

if match == "true" or match is None:
queryset = queryset.filter(content__content__contains=presence_match_structure)
Expand Down

0 comments on commit 96338f8

Please sign in to comment.