: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): restore input and output visibility controls (#123417)
Marius Andraa5499d2a1dfd
diff --git a/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.jupyter.test.tsx b/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.jupyter.test.tsxindex 29c3cdec0352..2928c3d4d129 100644--- a/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.jupyter.test.tsx+++ b/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.jupyter.test.tsx@@ -1,6 +1,7 @@import { act, fireEvent, render, waitFor, within } from '@testing-library/react'import { createElement, useCallback } from 'react'+import { useComponentPanelState } from './componentPanelContext'import { usePublishNotebookComponentRunHandler } from './componentRunHandlers'import { MarkdownNotebookJupyterModeConfig, NotebookJupyterCommands, useNotebookJupyterCommands } from './jupyterMode'import { MarkdownNotebook } from './MarkdownNotebook'@@ -38,7 +39,8 @@ const registry = createMarkdownNotebookRegistry([category: 'Code',defaultProps: { code: '' },insertCommand: {},- ViewComponent: () => createElement('div', null, 'output'),+ ViewComponent: () =>+ createElement('div', null, 'output', useComponentPanelState()?.jupyterOutputPrompt?.(false)),EditComponent: CodeEditorStandIn,ToolbarComponent: RunPublisher,},@@ -48,7 +50,8 @@ const registry = createMarkdownNotebookRegistry([category: 'Code',defaultProps: { code: '' },insertCommand: {},- ViewComponent: () => createElement('div', null, 'output'),+ ViewComponent: () =>+ createElement('div', null, 'output', useComponentPanelState()?.jupyterOutputPrompt?.(false)),EditComponent: CodeEditorStandIn,},])@@ -72,10 +75,11 @@ function renderJupyterNotebook(markdown: string): {cell: (index: number) => HTMLElementeditor: (index: number) => HTMLTextAreaElementsink: () => HTMLElement+ unmount: () => void} {runs.length = 0const onChange = jest.fn()- const { container } = render(+ const { container, unmount } = render(createElement(MarkdownNotebook, {value: markdown,onChange,@@ -88,6 +92,7 @@ function renderJupyterNotebook(markdown: string): {container.querySelectorAll<HTMLElement>('[data-attr="notebook-jupyter-cell"]')[index]return {container,+ unmount,latest: () => (onChange.mock.calls.at(-1)?.[0] as string | undefined) ?? markdown,cell,editor: (index) => cell(index).querySelector('[data-attr="cell-editor"]') as HTMLTextAreaElement,@@ -325,6 +330,68 @@ describe('MarkdownNotebook in Jupyter mode', () => {)})+ it.each(['previous', 'next'] as const)('focuses hidden input when moving to the %s cell', async (direction) => {+ const notebook = renderJupyterNotebook(TWO_CELLS)+ const targetIndex = direction === 'previous' ? 0 : 1+ const sourceIndex = 1 - targetIndex+ fireEvent.click(within(notebook.cell(targetIndex)).getByLabelText('Hide input'))+ act(() => notebook.editor(sourceIndex).focus())++ act(() => commands!.moveEditFocus(commands!.store.getState().activeCellId!, direction))++ await waitFor(() => expect(document.activeElement).toBe(notebook.editor(targetIndex)))+ })++ it.each([+ ['Py', false],+ ['Sql', false],+ ['Py', true],+ ])('keeps one %s section visible and restores hidden sections (legacy collapse: %s)', async (tag, bothHidden) => {+ const toggleVisibility = (cell: HTMLElement, label: string): void => {+ const prompt = within(cell).getByLabelText(label)+ act(() => prompt.focus())+ fireEvent.click(prompt)+ expect(document.activeElement).toBe(cell)+ }+ const notebook = renderJupyterNotebook(+ `# Title\n\n<${tag} code="original source"${bothHidden ? ' hideInput hideResults' : ''} />`+ )+ if (bothHidden) {+ expect(notebook.editor(0).value).toBe('original source')+ toggleVisibility(notebook.cell(0), 'Show output')+ expect(notebook.editor(0).value).toBe('original source')+ }+ toggleVisibility(notebook.cell(0), 'Hide input')+ expect(notebook.editor(0)).toBeNull()+ expect(within(notebook.cell(0)).getByText('output')).toBeTruthy()+ expect(within(notebook.cell(0)).getByLabelText('Show input').classList.contains('line-through')).toBe(true)++ fireEvent.click(within(notebook.cell(0)).getByLabelText('Hide output'))+ press(document.activeElement as HTMLElement, 'o')+ expect(within(notebook.cell(0)).getByText('output')).toBeTruthy()+ expect(notebook.editor(0)).toBeNull()+ const saved = notebook.latest()+ notebook.unmount()++ const reopened = renderJupyterNotebook(saved)+ expect(reopened.editor(0)).toBeNull()+ expect(within(reopened.cell(0)).getByText('output')).toBeTruthy()+ toggleVisibility(reopened.cell(0), 'Show input')+ expect(reopened.editor(0).value).toBe('original source')+ toggleVisibility(reopened.cell(0), 'Hide output')+ expect(within(reopened.cell(0)).queryByText('output')).toBeNull()+ expect(within(reopened.cell(0)).getByLabelText('Show output').classList.contains('line-through')).toBe(true)+ fireEvent.click(within(reopened.cell(0)).getByLabelText('Hide input'))+ expect(reopened.editor(0).value).toBe('original source')+ expect(within(reopened.cell(0)).queryByText('output')).toBeNull()++ toggleVisibility(reopened.cell(0), 'Show output')+ toggleVisibility(reopened.cell(0), 'Hide input')+ press(document.activeElement as HTMLElement, 'Enter')+ await waitFor(() => expect(document.activeElement).toBe(reopened.editor(0)))+ expect(reopened.editor(0).value).toBe('original source')+ })+it('never turns keys typed in a code editor into cell commands', () => {const notebook = renderJupyterNotebook(TWO_CELLS)for (const key of ['a', 'b', 'd', 'd', 'm', 'Delete', 'Backspace']) {@@ -333,18 +400,29 @@ describe('MarkdownNotebook in Jupyter mode', () => {expect(notebook.latest()).toEqual(TWO_CELLS)})- it('runs with Shift+Enter, selects the next cell, and adds a cell after the last one', async () => {- const notebook = renderJupyterNotebook(TWO_CELLS)- press(notebook.editor(0), 'Enter', { shiftKey: true })- await flushFrames()- expect(runs).toEqual(['a = 1'])- expect(document.activeElement).toBe(notebook.cell(1))+ it.each([null, 'Hide input', 'Hide output'])(+ 'runs with Shift+Enter, selects the next cell, and appends a cell (visibility action: %s)',+ async (visibilityAction) => {+ const notebook = renderJupyterNotebook(TWO_CELLS)+ if (visibilityAction) {+ const prompt = within(notebook.cell(0)).getByLabelText(visibilityAction)+ act(() => prompt.focus())+ fireEvent.click(prompt)+ } else {+ act(() => notebook.editor(0).focus())+ }+ const beforeAppend = notebook.latest()+ press(document.activeElement as HTMLElement, 'Enter', { shiftKey: true })+ await flushFrames()+ expect(runs).toEqual(['a = 1'])+ expect(document.activeElement).toBe(notebook.cell(1))- press(notebook.cell(1), 'Enter', { shiftKey: true })- await flushFrames()- expect(runs).toEqual(['a = 1', 'b = 2'])- expect(notebook.latest()).toEqual(`${TWO_CELLS}\n\n<Py code="" />`)- })+ press(notebook.cell(1), 'Enter', { shiftKey: true })+ await flushFrames()+ expect(runs).toEqual(['a = 1', 'b = 2'])+ expect(notebook.latest()).toEqual(`${beforeAppend}\n\n<Py code="" />`)+ }+ )it('selects a markdown cell in command mode, where letter keys act on it instead of typing', async () => {const notebook = renderJupyterNotebook(TWO_CELLS)diff --git a/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.scss b/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.scssindex badeec84999c..22d62af228d3 100644--- a/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.scss+++ b/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.scss@@ -2461,6 +2461,8 @@ button.MarkdownNotebook__component-title:focus-visible {}.MarkdownNotebook__jupyter-prompt {+ position: relative;+ z-index: 2;flex: 0 0 var(--jupyter-prompt-width);padding: 0.5rem 0.5rem 0 0;font-family: var(--font-mono);@@ -2468,6 +2470,7 @@ button.MarkdownNotebook__component-title:focus-visible {line-height: 1.3;text-align: right;white-space: nowrap;+ pointer-events: none;user-select: none;opacity: 0.8;}@@ -2569,21 +2572,49 @@ button.MarkdownNotebook__component-title:focus-visible {color: var(--color-text-error);}-.MarkdownNotebook__jupyter-output-collapsed {- display: block;- width: calc(100% - var(--jupyter-prompt-width));- height: 0.75rem;- margin: 0.25rem 0 0 var(--jupyter-prompt-width);- font-size: 0.75rem;- line-height: 0.5rem;- color: var(--color-text-secondary);- cursor: pointer;- background: var(--jupyter-editor-background);- border: none;- border-radius: 2px;+.MarkdownNotebook__jupyter-prompt-actions {+ display: flex;+ flex-direction: column;+ gap: 0.125rem;+ align-items: flex-end;+ pointer-events: auto;- &:hover {- background: var(--jupyter-table-hover);+ .LemonButton {+ --lemon-button-font-size: var(--jupyter-prompt-font-size);++ font-family: var(--font-mono);+ color: var(--lemon-button-color);+ cursor: pointer;++ &.LemonButton--tertiary,+ &.LemonButton--tertiary:hover,+ &.LemonButton--tertiary[aria-expanded='true'] {+ background: none;+ }++ &[aria-disabled='true']:not(.LemonButton--loading) {+ opacity: 1;+ }++ &.MarkdownNotebook__jupyter-prompt-button--input {+ --lemon-button-color: var(--jupyter-input-prompt-color);+ }++ &.MarkdownNotebook__jupyter-prompt-button--output {+ --lemon-button-color: var(--jupyter-output-prompt-color);+ }++ &.line-through {+ --lemon-button-color: var(--color-text-secondary);+ }++ .LemonButton__chrome {+ line-height: 1.3;+ }++ .LemonButton__content {+ font-weight: 400;+ }}}diff --git a/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.tsx b/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.tsxindex ba198cf834b1..78fef0d2897f 100644--- a/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.tsx+++ b/frontend/src/lib/components/MarkdownNotebook/MarkdownNotebook.tsx@@ -5926,11 +5926,20 @@ function MarkdownNotebookEditor({}const definition = getMarkdownNotebookComponentDefinition(mergedRegistry, node.tagName)const panels = getComponentPanelVisibility(node, DEFAULT_COMPONENT_PANEL_VISIBILITY)- updateNode(node.id, (currentNode) =>- currentNode.type === 'component'- ? withPersistedComponentPanelProps(currentNode, definition, { ...panels, results: !panels.results })- : currentNode- )+ if (panels.results && node.props.hideInput === true) {+ return+ }+ updateNode(node.id, (currentNode) => {+ if (currentNode.type !== 'component') {+ return currentNode+ }+ const props = { ...currentNode.props }+ delete props.hideInput+ return withPersistedComponentPanelProps({ ...currentNode, props }, definition, {+ ...panels,+ results: !panels.results,+ })+ })}const executeJupyterCommand = (command: NotebookJupyterCommand, cellOrNodeId: string | null): void => {diff --git a/frontend/src/lib/components/MarkdownNotebook/NotebookComponentShell.tsx b/frontend/src/lib/components/MarkdownNotebook/NotebookComponentShell.tsxindex 25d6dc47eed6..3c5149be1562 100644--- a/frontend/src/lib/components/MarkdownNotebook/NotebookComponentShell.tsx+++ b/frontend/src/lib/components/MarkdownNotebook/NotebookComponentShell.tsx@@ -394,6 +394,10 @@ export function NotebookComponentShell({if (!jupyterStore || !isJupyterEditFocusRequested) {return}+ if (nodeRef.current.props.hideInput === true) {+ shellRef.current?.focus({ preventScroll: true })+ updateProps({ hideInput: undefined })+ }const deadline = Date.now() + EDIT_FOCUS_TIMEOUT_MSlet timer = 0const tryFocus = (): void => {@@ -618,6 +622,60 @@ export function NotebookComponentShell({const isRunning = !!runHandler?.isRunningconst executionCount = runHandler?.executionCount ?? nullconst canEditCells = mode === 'edit'+ const showOutput = componentPanels.results || !canToggleComponentPanels+ const showInput = node.props.hideInput !== true || !showOutput+ const inputLabel = formatJupyterInputPrompt(isRunning, executionCount)+ const inputPrompt = canEditCells ? (+ <LemonButton+ size="xxsmall"+ noPadding+ className={clsx('MarkdownNotebook__jupyter-prompt-button--input', !showInput && 'line-through')}+ aria-label={showInput ? 'Hide input' : 'Show input'}+ aria-expanded={showInput}+ data-attr={showInput ? 'notebook-jupyter-toggle-input' : 'notebook-jupyter-show-input'}+ tooltip={showInput ? 'click to hide' : 'click to show'}+ disabledReason={showInput && !showOutput ? 'Show output before hiding input' : undefined}+ onClick={() => {+ if (!showInput || showOutput) {+ shellRef.current?.focus({ preventScroll: true })+ updateProps({ hideInput: showInput ? true : undefined })+ }+ }}+ >+ {inputLabel}+ </LemonButton>+ ) : (+ <span>{inputLabel}</span>+ )+ const outputPrompt = (isError = runHandler?.hasError ?? false): JSX.Element => {+ const label = `${isError ? 'Err' : 'Out'}[${executionCount ?? ' '}]:`+ return canEditCells ? (+ <LemonButton+ size="xxsmall"+ noPadding+ className={clsx('MarkdownNotebook__jupyter-prompt-button--output', !showOutput && 'line-through')}+ aria-label={showOutput ? 'Hide output' : 'Show output'}+ aria-expanded={showOutput}+ data-attr={showOutput ? 'notebook-jupyter-hide-output' : 'notebook-jupyter-show-output'}+ tooltip={showOutput ? 'click to hide' : 'click to show'}+ disabledReason={showOutput && !showInput ? 'Show input before hiding output' : undefined}+ onClick={() => {+ shellRef.current?.focus({ preventScroll: true })+ jupyter.executeCommand('toggle-output', node.id)+ }}+ >+ {label}+ </LemonButton>+ ) : (+ <span>{label}</span>+ )+ }+ const outputPrompts = (isError: boolean): JSX.Element => (+ <div className="MarkdownNotebook__jupyter-prompt-actions" onKeyDown={(event) => event.stopPropagation()}>+ {!showInput ? inputPrompt : null}+ {outputPrompt(isError)}+ </div>+ )return (<divclassName={clsx(@@ -663,36 +721,46 @@ export function NotebookComponentShell({/>) : null}<NotebookComponentToolbarExtrasContext.Provider value={setToolbarExtras}>- <ComponentPanelContext.Provider value={componentPanelState}>- <div className="MarkdownNotebook__jupyter-input">- <div- className="MarkdownNotebook__jupyter-prompt MarkdownNotebook__jupyter-prompt--input"- title={isRunning ? 'Running' : undefined}- >- {formatJupyterInputPrompt(isRunning, executionCount)}- </div>- <div className="MarkdownNotebook__jupyter-input-area">- {errors.length ? (- <div className="MarkdownNotebook__component-errors">- {errors.map((error) => (- <div key={error}>{error}</div>- ))}+ <ComponentPanelContext.Provider+ value={{ ...componentPanelState, jupyterOutputPrompt: outputPrompts }}+ >+ {showInput ? (+ <div className="MarkdownNotebook__jupyter-input">+ <div+ className="MarkdownNotebook__jupyter-prompt MarkdownNotebook__jupyter-prompt--input"+ title={isRunning ? 'Running' : undefined}+ >+ <div+ className="MarkdownNotebook__jupyter-prompt-actions"+ onKeyDown={(event) => event.stopPropagation()}+ >+ {inputPrompt}+ {!showOutput ? outputPrompt() : null}</div>- ) : null}- {EditComponent ? (- <NotebookComponentPanelErrorBoundary node={node} panel="filters">- <EditComponent- node={node}- mode={canEditCells ? 'edit' : 'view'}- notebookMode={mode}- updateProps={updateProps}- deleteNode={deleteNode}- />- </NotebookComponentPanelErrorBoundary>- ) : null}+ </div>+ <div className="MarkdownNotebook__jupyter-input-area">+ {errors.length ? (+ <div className="MarkdownNotebook__component-errors">+ {errors.map((error) => (+ <div key={error}>{error}</div>+ ))}+ </div>+ ) : null}+ {EditComponent ? (+ <NotebookComponentPanelErrorBoundary node={node} panel="filters">+ <EditComponent+ node={node}+ mode={canEditCells ? 'edit' : 'view'}+ notebookMode={mode}+ updateProps={updateProps}+ deleteNode={deleteNode}+ />+ </NotebookComponentPanelErrorBoundary>+ ) : null}+ </div></div>- </div>- {componentPanels.results || !canToggleComponentPanels ? (+ ) : null}+ {showOutput ? (<div className="MarkdownNotebook__jupyter-output">{ViewComponent ? (<NotebookComponentPanelErrorBoundary node={node} panel="results">@@ -708,17 +776,7 @@ export function NotebookComponentShell({<UnknownComponentView node={node} />)}</div>- ) : (- <button- type="button"- className="MarkdownNotebook__jupyter-output-collapsed"- aria-label="Show output"- title="Show output (O)"- onClick={() => toggleComponentPanel('results')}- >- …- </button>- )}+ ) : null}</ComponentPanelContext.Provider></NotebookComponentToolbarExtrasContext.Provider>{canEditCells ? (diff --git a/frontend/src/lib/components/MarkdownNotebook/componentPanelContext.ts b/frontend/src/lib/components/MarkdownNotebook/componentPanelContext.tsindex 126db4dacce5..e37428e0b6c8 100644--- a/frontend/src/lib/components/MarkdownNotebook/componentPanelContext.ts+++ b/frontend/src/lib/components/MarkdownNotebook/componentPanelContext.ts@@ -1,4 +1,4 @@-import { createContext, useContext } from 'react'+import { ReactNode, createContext, useContext } from 'react'import { ComponentPanelVisibility } from './componentPanels'@@ -6,6 +6,7 @@ export type ComponentPanelState = {componentPanels: ComponentPanelVisibilityshowEditPanel: booleanshowViewPanel: boolean+ jupyterOutputPrompt?: (isError: boolean) => ReactNode}export const ComponentPanelContext = createContext<ComponentPanelState | null>(null)diff --git a/frontend/src/lib/components/MarkdownNotebook/componentRunHandlers.ts b/frontend/src/lib/components/MarkdownNotebook/componentRunHandlers.tsindex e055b23c14c9..539fddf59aff 100644--- a/frontend/src/lib/components/MarkdownNotebook/componentRunHandlers.ts+++ b/frontend/src/lib/components/MarkdownNotebook/componentRunHandlers.ts@@ -9,6 +9,7 @@ export type NotebookComponentRunHandler = {/** Waiting behind another cell. It counts as running for the prompt, as Jupyter shows In [*]. */isQueued?: booleanexecutionCount?: number | null+ hasError?: booleaninterrupt?: () => void}@@ -24,6 +25,7 @@ export function usePublishNotebookComponentRunHandler(handler: NotebookComponentconst isRunning = handler?.isRunning ?? falseconst isQueued = handler?.isQueued ?? falseconst executionCount = handler?.executionCount ?? null+ const hasError = handler?.hasError ?? falseconst interrupt = handler?.interruptuseEffect(() => {@@ -31,8 +33,10 @@ export function usePublishNotebookComponentRunHandler(handler: NotebookComponentreturn}- publishRunHandler(run ? { run, disabledReason, isRunning, isQueued, executionCount, interrupt } : null)+ publishRunHandler(+ run ? { run, disabledReason, isRunning, isQueued, executionCount, hasError, interrupt } : null+ )return () => publishRunHandler(null)- }, [publishRunHandler, run, disabledReason, isRunning, isQueued, executionCount, interrupt])+ }, [publishRunHandler, run, disabledReason, isRunning, isQueued, executionCount, hasError, interrupt])}diff --git a/frontend/src/scenes/notebooks/Nodes/components/NotebookCodeCellRunButton.tsx b/frontend/src/scenes/notebooks/Nodes/components/NotebookCodeCellRunButton.tsxindex b40b8159586e..d6905983df1d 100644--- a/frontend/src/scenes/notebooks/Nodes/components/NotebookCodeCellRunButton.tsx+++ b/frontend/src/scenes/notebooks/Nodes/components/NotebookCodeCellRunButton.tsx@@ -52,7 +52,10 @@ export function NotebookCodeCellRunButton({ node, updateProps }: NotebookComponeisInterrupting,operationBlockReason,isJupyterModeActive,+ runError,+ result: runResult,} = useValues(dataLogic)+ const result = runResult ?? (node.props.result as NotebookNodeSQLV2Result | undefined)// A queued cell shows as running, like Jupyter's In [*] for a cell waiting on the kernel.const isRunning = isRunningNow || isQueuedconst { runNode, interruptRun } = useActions(dataLogic)@@ -107,6 +110,7 @@ export function NotebookCodeCellRunButton({ node, updateProps }: NotebookComponeisRunning,isQueued,executionCount,+ hasError: !!runError || !!result?.stderr,interrupt,}: nulldiff --git a/frontend/src/scenes/notebooks/Nodes/components/NotebookJupyterCellOutput.tsx b/frontend/src/scenes/notebooks/Nodes/components/NotebookJupyterCellOutput.tsxindex c083731cdf04..cef7b1d75732 100644--- a/frontend/src/scenes/notebooks/Nodes/components/NotebookJupyterCellOutput.tsx+++ b/frontend/src/scenes/notebooks/Nodes/components/NotebookJupyterCellOutput.tsx@@ -1,6 +1,8 @@import clsx from 'clsx'import { ReactNode } from 'react'+import { useComponentPanelState } from 'lib/components/MarkdownNotebook/componentPanelContext'+import type { NotebookNodeSQLV2Result } from '../NotebookNodeSQLV2'import { NotebookDataframeResult } from '../pythonExecution'import { NotebookJupyterDataframe, NotebookJupyterDataframeProps } from './NotebookJupyterDataframe'@@ -24,7 +26,7 @@ function OutputRow({className,children,}: {- prompt?: string+ prompt?: ReactNodeclassName?: stringchildren: ReactNode}): JSX.Element {@@ -53,7 +55,9 @@ export function NotebookJupyterCellOutput({valueOverride,footerExtra,}: NotebookJupyterCellOutputProps): JSX.Element | null {- const outPrompt = `Out[${executionCount ?? ' '}]:`+ const interactivePrompt = useComponentPanelState()?.jupyterOutputPrompt+ const outPrompt = interactivePrompt?.(false) ?? <span>{`Out[${executionCount ?? ' '}]:`}</span>+ const errPrompt = interactivePrompt?.(true) ?? <span>{`Err[${executionCount ?? ' '}]:`}</span>const media = result?.media ?? []const firstPageLength = result?.first_page?.length ?? 0// The kernel's row_count is the page size for a paged frame, so it only counts as the total@@ -61,31 +65,48 @@ export function NotebookJupyterCellOutput({const totalRowCount = result && !result.has_more && result.row_count >= firstPageLength ? result.row_count : nullconst resultText = !dataframeResult && !runError ? result?.result_text : undefinedconst hasValue = !!dataframeResult || media.length > 0 || !!resultText+ const hasValueRow = !!resultText || (!!dataframeResult && !runError)+ const leadingPrompt = interactivePrompt && !hasValueRow ? { prompt: outPrompt } : {}if (!status && !result?.stdout && !result?.stderr && !runError && !hasValue) {- return null+ return interactivePrompt ? <OutputRow prompt={outPrompt}>{null}</OutputRow> : null}return (<div className="py-0.5" onClick={(event) => event.stopPropagation()}>- {status ? <OutputRow className="MarkdownNotebook__jupyter-output-area--muted">{status}</OutputRow> : null}+ {status ? (+ <OutputRow {...leadingPrompt} className="MarkdownNotebook__jupyter-output-area--muted">+ {status}+ </OutputRow>+ ) : null}{result?.stdout ? (- <OutputRow>+ <OutputRow {...(!status ? leadingPrompt : {})}><pre>{result.stdout}</pre></OutputRow>) : null}{result?.stderr ? (- <OutputRow className="MarkdownNotebook__jupyter-output-area--stderr">+ <OutputRow+ {...(!status && !result?.stdout && !hasValueRow ? { prompt: errPrompt } : {})}+ className="MarkdownNotebook__jupyter-output-area--stderr"+ ><pre>{result.stderr}</pre></OutputRow>) : null}{runError ? (- <OutputRow className="MarkdownNotebook__jupyter-output-area--error">+ <OutputRow+ {...(!status && !result?.stdout && !result?.stderr && !hasValueRow ? { prompt: errPrompt } : {})}+ className="MarkdownNotebook__jupyter-output-area--error"+ ><pre>{runError}</pre></OutputRow>) : null}{media.map((item, index) => (- <OutputRow key={index}>+ <OutputRow+ key={index}+ {...(index === 0 && !status && !result?.stdout && !result?.stderr && !runError+ ? leadingPrompt+ : {})}+ ><img src={`data:${item.mime_type};base64,${item.data}`} alt="Cell output" /></OutputRow>))}