Skip to content

: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.

fix(notebooks): hide cursors in history preview (#58863)

Alex Lider05c3ce64a2dd
diff --git a/frontend/src/scenes/notebooks/Notebook/Editor.tsx b/frontend/src/scenes/notebooks/Notebook/Editor.tsx
index dfa6582126d2..96e8e2c121a0 100644
--- a/frontend/src/scenes/notebooks/Notebook/Editor.tsx
+++ b/frontend/src/scenes/notebooks/Notebook/Editor.tsx
@@ -75,11 +75,11 @@ const CustomDocument = ExtensionDocument.extend({
})
export function Editor(): JSX.Element {
- const { shortId, mode, isEditable, content, collabEnabled, notebook } = useValues(notebookLogic)
+ const { shortId, mode, isEditable, content, collabEnabled, notebook, previewContent } = useValues(notebookLogic)
const { setEditor, onEditorUpdate, onEditorSelectionUpdate, setTableOfContents, insertComment } =
useActions(notebookLogic)
const hasCollapsibleSections = useFeatureFlag('NOTEBOOKS_COLLAPSIBLE_SECTIONS')
- const { bindEditor } = useActions(notebookCollabLogic({ shortId }))
+ const { bindEditor, unbindEditor } = useActions(notebookCollabLogic({ shortId }))
const { clientID } = useValues(notebookCollabLogic({ shortId }))
const { resetSuggestions, setPreviousNode } = useActions(insertionSuggestionsLogic)
@@ -96,7 +96,9 @@ export function Editor(): JSX.Element {
trailingNode: false,
}
- const useCollab = collabEnabled && !!notebook
+ const useCollab = collabEnabled && !!notebook && !previewContent
+ // Collab suffix forces editor to re-initialize so the collab plugin is present
+ const editorKey = `Notebook.${shortId}${useCollab ? '-collab' : ''}`
const extensions = [
mode === 'notebook' ? CustomDocument : ExtensionDocument,
@@ -195,8 +197,8 @@ export function Editor(): JSX.Element {
return (
<RichContentEditor
- // Collab suffix forces editor to re-initialize so the collab plugin is present
- logicKey={`Notebook.${shortId}${useCollab ? '-collab' : ''}`}
+ key={editorKey}
+ logicKey={editorKey}
extensions={extensions}
disabled={!isEditable}
className="NotebookEditor flex flex-col flex-1"
@@ -216,6 +218,8 @@ export function Editor(): JSX.Element {
if (useCollab) {
bindEditor(editor)
+ } else {
+ unbindEditor()
}
}}
>