: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(notebooks): keep scene when deleting a note from the side panel (#69670)
Arthur Moreira de Deuse511a5c92a13
diff --git a/frontend/src/scenes/notebooks/NotebookMenu.tsx b/frontend/src/scenes/notebooks/NotebookMenu.tsxindex 6f5fbffa29bb..242e401a9203 100644--- a/frontend/src/scenes/notebooks/NotebookMenu.tsx+++ b/frontend/src/scenes/notebooks/NotebookMenu.tsx@@ -18,7 +18,7 @@ import { notebooksModel } from '~/models/notebooksModel'import { isMarkdownNotebookContent } from './Notebook/markdownNotebookV2'import { NotebookLogicProps, notebookLogic } from './Notebook/notebookLogic'-export function NotebookMenu({ shortId }: NotebookLogicProps): JSX.Element {+export function NotebookMenu({ shortId, inPanel }: NotebookLogicProps & { inPanel?: boolean }): JSX.Element {const { notebook, showHistory, isLocalOnly, content } = useValues(notebookLogic({ shortId }))const { openShareModal, duplicateNotebook, exportJSON, downloadMarkdown, copyMarkdown, setShowHistory } =useActions(notebookLogic({ shortId }))@@ -78,7 +78,11 @@ export function NotebookMenu({ shortId }: NotebookLogicProps): JSX.Element {<ButtonPrimitiveonClick={() => {notebooksModel.actions.deleteNotebook(shortId, notebook?.title)- router.actions.push(urls.notebooks())+ // In the side panel the deleted notebook is swapped for the+ // scratchpad in place, so we stay on the current scene.+ if (!inPanel) {+ router.actions.push(urls.notebooks())+ }}}menuItemvariant="danger"diff --git a/frontend/src/scenes/notebooks/NotebookPanel/NotebookPanel.tsx b/frontend/src/scenes/notebooks/NotebookPanel/NotebookPanel.tsxindex 7403befbf4cc..e5ade1bc70e9 100644--- a/frontend/src/scenes/notebooks/NotebookPanel/NotebookPanel.tsx+++ b/frontend/src/scenes/notebooks/NotebookPanel/NotebookPanel.tsx@@ -68,7 +68,7 @@ export function NotebookPanel(): JSX.Element | null {<div className="flex-1" /><div className="flex items-center gap-1">{selectedNotebook && <NotebookPresence shortId={selectedNotebook} />}- <NotebookMenu shortId={selectedNotebook} />+ <NotebookMenu shortId={selectedNotebook} inPanel />{contentWidthHasEffect && (<NotebookExpandButtonsize="small"