From c960a983a07012c37783a356c74c47f91bb6a44a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 16 Jun 2026 05:32:11 +0000 Subject: [PATCH] =?UTF-8?q?perf(cuesheet):=20lazily=20mount=20text-cell=20?= =?UTF-8?q?editors=20(Exp=20A)=20=E2=80=94=20validated=20win?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Render a lightweight, focusable TextLikeInput for cue/title/note/custom cells and only mount the real input/textarea editor (with reactive-input hooks and autosize) on click/focus, mirroring the existing time/duration cells. Measured baseline vs Exp A at CPU 4x (median of 3, ~1140 row mounts): - longFrames 201 -> 127 (-37%), maxFrameMs 517 -> 417 (-19%) - longtask total 58.9s -> 30.7s (-48%), EventRow.mount avg 179 -> 146ms (-18%) - cell.autosize and cell.reactiveInputInit eliminated from the scroll path - per-row re-renders 4648 -> 3048 (-34%): stable display height, no virtuoso churn (the opposite of the reverted lazy-autosize Exp B, which doubled re-renders) Editing verified end-to-end: click mounts+focuses the editor, edits persist, editor unmounts back to the display on commit. TextLikeInput now fills its cell so the whole cell is clickable to edit. --- .../cuesheet-table-elements/EditableCell.tsx | 86 +++++++++++++++++++ .../cuesheet-table-elements/MultiLineCell.tsx | 29 +++++-- .../TextLikeInput.module.scss | 14 ++- .../cuesheet-table-elements/TextLikeInput.tsx | 4 +- .../cuesheetColsFactory.tsx | 11 +-- 5 files changed, 132 insertions(+), 12 deletions(-) create mode 100644 apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/EditableCell.tsx diff --git a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/EditableCell.tsx b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/EditableCell.tsx new file mode 100644 index 000000000..2c7541e2e --- /dev/null +++ b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/EditableCell.tsx @@ -0,0 +1,86 @@ +import { memo, useCallback, useEffect, useRef, useState } from 'react'; + +import MultiLineCell from './MultiLineCell'; +import SingleLineCell from './SingleLineCell'; +import TextLikeInput from './TextLikeInput'; + +interface EditableCellProps { + initialValue: string; + multiline?: boolean; + fieldId?: string; + fieldLabel?: string; + handleUpdate: (newValue: string) => void; +} + +interface FocusableEditor { + focus: () => void; + select?: () => void; +} + +/** + * Lazily mounts the text editor for a cell. + * + * Mounting an ``/`