diff --git a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--closed-popover-state.png b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--closed-popover-state.png index 72044664032ff..0bd1a2ec72dc0 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--closed-popover-state.png and b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--closed-popover-state.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--default.png b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--default.png index fd4ecc9b1daac..135fbf78576bd 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--default.png and b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--default.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-existing-containing-notebooks.png b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-existing-containing-notebooks.png index 7177af7c635a5..ad991275b2679 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-existing-containing-notebooks.png and b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-existing-containing-notebooks.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-notebooks.png b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-notebooks.png index fd4ecc9b1daac..135fbf78576bd 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-notebooks.png and b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-no-notebooks.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response-closed-popover.png b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response-closed-popover.png index 7f2f047e58950..8ea1d12c65485 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response-closed-popover.png and b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response-closed-popover.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response.png b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response.png index 8cca1defebf8e..57ff65022efe1 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response.png and b/frontend/__snapshots__/scenes-app-notebooks-components-notebook-select-button--with-slow-network-response.png differ diff --git a/frontend/src/models/notebooksModel.ts b/frontend/src/models/notebooksModel.ts index 249b6055b6847..80bff3e240923 100644 --- a/frontend/src/models/notebooksModel.ts +++ b/frontend/src/models/notebooksModel.ts @@ -21,7 +21,7 @@ import { InsightVizNode, Node, NodeKind } from '~/queries/schema' export const SCRATCHPAD_NOTEBOOK: NotebookListItemType = { short_id: 'scratchpad', - title: 'Scratchpad', + title: 'My scratchpad', created_at: '', created_by: null, } diff --git a/frontend/src/scenes/notebooks/Notebook/NotebookListMini.tsx b/frontend/src/scenes/notebooks/Notebook/NotebookListMini.tsx index 8adeb7f4236c9..08237a4e8d27d 100644 --- a/frontend/src/scenes/notebooks/Notebook/NotebookListMini.tsx +++ b/frontend/src/scenes/notebooks/Notebook/NotebookListMini.tsx @@ -16,7 +16,7 @@ export function NotebookListMini({ selectedNotebookId }: NotebookListMiniProps): const selectedTitle = selectedNotebookId === 'scratchpad' - ? 'Scratchpad' + ? 'My scratchpad' : notebookTemplates.find((notebook) => notebook.short_id === selectedNotebookId)?.title || notebooks.find((notebook) => notebook.short_id === selectedNotebookId)?.title || 'Untitled' diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts index 9b85bfa5130bd..80ec5b615fdb7 100644 --- a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts +++ b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts @@ -9,7 +9,7 @@ import { NotebookNodeType, NotebookType } from '~/types' export const NOTEBOOKS_VERSION = '1' export function migrate(notebook: NotebookType): NotebookType { - let content = notebook.content.content + let content = notebook.content?.content if (!content) { return notebook diff --git a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts index c6049f51a7144..855d89a7f4540 100644 --- a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts +++ b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts @@ -111,7 +111,7 @@ export const notebookLogic = kea([ reducers(({ props }) => ({ localContent: [ null as JSONContent | null, - { persist: props.mode === 'notebook', prefix: NOTEBOOKS_VERSION }, + { persist: props.mode !== 'canvas', prefix: NOTEBOOKS_VERSION }, { setLocalContent: (_, { jsonContent }) => jsonContent, clearLocalContent: () => null, @@ -198,7 +198,7 @@ export const notebookLogic = kea([ if (props.shortId === SCRATCHPAD_NOTEBOOK.short_id) { response = { ...values.scratchpadNotebook, - content: {}, + content: null, text_content: null, version: 0, } @@ -215,7 +215,7 @@ export const notebookLogic = kea([ const notebook = migrate(response) - if (!values.notebook) { + if (!values.notebook && notebook.content) { // If this is the first load we need to override the content fully values.editor?.setContent(notebook.content) } diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx index 76f201e9df296..fdff5f9f2d1f1 100644 --- a/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx +++ b/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx @@ -130,6 +130,15 @@ export function NotebookSelectList(props: NotebookSelectProps): JSX.Element { } onClick={openNewNotebook}> New notebook + { + setShowPopover(false) + openAndAddToNotebook('scratchpad', false) + }} + > + My scratchpad +
diff --git a/frontend/src/types.ts b/frontend/src/types.ts index c59ab2d0a9f50..292f04183121b 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -3060,7 +3060,7 @@ export type NotebookListItemType = { } export type NotebookType = NotebookListItemType & { - content: JSONContent // TODO: Type this better + content: JSONContent | null version: number // used to power text-based search text_content?: string | null