From 8dc26e152f4cf442def11e7985e823e11c5adab3 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 29 Aug 2026 01:35:28 -0700 Subject: [PATCH 01/11] perf(editor): stop re-rendering every code block on each keystroke (#17008) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf(editor): stop re-rendering every code block on each keystroke Profiling a 305 KB document in a packaged build showed typing was dominated by two things that had nothing to do with the text being typed. Tiptap re-renders a React node view whenever its document *position* changes, even when the node and its decorations are untouched (@tiptap/react 3.22.5, ReactNodeView.update). Typing shifts the position of every node after the caret, so one keystroke in a document with 533 code blocks cost 533 React renders. That re-render only exists so a component can observe a fresh getPos(); RichMarkdownCodeBlock never reads it, so it now opts out via an explicit `update`. getPos() stays correct for later callers — Tiptap updates its position bookkeeping before calling `update`, and passes getPos as a live function rather than a captured value. The language only paints its selected option, so until the + // user reaches for the list one entry renders the same visible label. + + )} {/* If the document has a language not in our list, show it as-is */} - {language && !LANGUAGES.some((l) => l.value === language) ? ( - + {languageListMounted && language && !isKnownCodeBlockLanguage(language) ? ( + ) : null}