From 8ff764bb573c6a98368b2ae3503890551a1c3842 Mon Sep 17 00:00:00 2001 From: David Newell Date: Tue, 19 Sep 2023 16:30:05 +0100 Subject: [PATCH] chore: remove unused empty state (#17529) --- frontend/src/scenes/notebooks/Notebook/Editor.tsx | 1 - frontend/src/scenes/notebooks/Notebook/Notebook.tsx | 10 +--------- .../src/scenes/notebooks/Notebook/notebookLogic.ts | 6 ------ frontend/src/scenes/notebooks/Notebook/utils.ts | 1 - 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/frontend/src/scenes/notebooks/Notebook/Editor.tsx b/frontend/src/scenes/notebooks/Notebook/Editor.tsx index 2a41bcce88209..0f4e83aa16485 100644 --- a/frontend/src/scenes/notebooks/Notebook/Editor.tsx +++ b/frontend/src/scenes/notebooks/Notebook/Editor.tsx @@ -191,7 +191,6 @@ export function Editor({ setSelection: (position: number) => editor.commands.setNodeSelection(position), focus: (position: EditorFocusPosition) => queueMicrotask(() => editor.commands.focus(position)), destroy: () => editor.destroy(), - isEmpty: () => editor.isEmpty, deleteRange: (range: EditorRange) => editor.chain().focus().deleteRange(range), insertContent: (content: JSONContent) => editor.chain().insertContent(content).focus().run(), insertContentAfterNode: (position: number, content: JSONContent) => { diff --git a/frontend/src/scenes/notebooks/Notebook/Notebook.tsx b/frontend/src/scenes/notebooks/Notebook/Notebook.tsx index 6e9adb4825f7b..2da4dac9c5ea6 100644 --- a/frontend/src/scenes/notebooks/Notebook/Notebook.tsx +++ b/frontend/src/scenes/notebooks/Notebook/Notebook.tsx @@ -26,7 +26,7 @@ const PLACEHOLDER_TITLES = ['Release notes', 'Product roadmap', 'Meeting notes', export function Notebook({ shortId, editable = false, initialAutofocus = null }: NotebookProps): JSX.Element { const logic = notebookLogic({ shortId }) - const { notebook, content, notebookLoading, isEmpty, editor, conflictWarningVisible } = useValues(logic) + const { notebook, content, notebookLoading, editor, conflictWarningVisible } = useValues(logic) const { setEditor, onEditorUpdate, duplicateNotebook, loadNotebook, setEditable, onEditorSelectionUpdate } = useActions(logic) const { isExpanded } = useValues(notebookSettingsLogic) @@ -57,14 +57,6 @@ export function Notebook({ shortId, editable = false, initialAutofocus = null }: return } else if (!notebook) { return - } else if (isEmpty && !editable) { - return ( -
-

- Untitled -

-
- ) } return ( diff --git a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts index 91b656b354ac1..eeaf9c2200bc3 100644 --- a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts +++ b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts @@ -292,12 +292,6 @@ export const notebookLogic = kea([ return contentTitle || notebook?.title || 'Untitled' }, ], - isEmpty: [ - (s) => [s.editor, s.content], - (editor: NotebookEditor): boolean => { - return editor?.isEmpty() || false - }, - ], syncStatus: [ (s) => [s.notebook, s.notebookLoading, s.localContent, s.isLocalOnly], (notebook, notebookLoading, localContent, isLocalOnly): NotebookSyncStatus => { diff --git a/frontend/src/scenes/notebooks/Notebook/utils.ts b/frontend/src/scenes/notebooks/Notebook/utils.ts index c5b6f045a3005..30f1cbbf384e1 100644 --- a/frontend/src/scenes/notebooks/Notebook/utils.ts +++ b/frontend/src/scenes/notebooks/Notebook/utils.ts @@ -63,7 +63,6 @@ export interface NotebookEditor { setSelection: (position: number) => void focus: (position: EditorFocusPosition) => void destroy: () => void - isEmpty: () => boolean deleteRange: (range: EditorRange) => EditorCommands insertContent: (content: JSONContent) => void insertContentAfterNode: (position: number, content: JSONContent) => void