Repository navigation
[lexical][lexical-website] Bug Fix: Homepage crash from optimized dev build - #8861
Merged
etrepum merged 5 commits intoJul 21, 2026
Merged
Conversation
… build ## Description The website homepage crashed entirely with `nV (type tab) must implement a static clone method since its constructor has 1 required arguments (expecting 0)`, taking down every embedded example. Root cause: the website bundles the dev build of `lexical` (so the node registration invariants are live) but minifies it for production. The minifier strips `arg = undefined` default-parameter assignments, which inflates `Function.length` for node constructors. The existing `TextNode.length === 0` guard detects non-ES6 compiler output but not a minified build — `TextNode`'s own `text = ''` default survives minification (`''` is not `undefined`) — so the clone/`importJSON` `klass.length === 0` invariants false-fired at runtime and crashed the first example to mount. This PR: - **lexical**: only run the clone/`importJSON` length invariants when the build is unoptimized, detected via `TextNode.name === 'TextNode'` (class names are mangled once the output is minified). - **lexical-website**: wrap each embedded homepage example in its own error boundary (built on `@lexical/react`'s `LexicalErrorBoundary`) so a single failing example no longer takes down the whole page. The fallback renders a `data-example-error` marker. - **lexical-website**: add a homepage smoke test that loads the built site in a browser and fails if an embedded example throws at runtime, wired into the core CI job. A green `build` alone does not catch this class of failure. Closes meta#8860 ## Test plan ### Before - Built the website (`pnpm --filter @lexical/website build`) and loaded the homepage in Chromium: the first example threw the clone invariant and the page failed to render. - Injected a client-only render crash into one example and ran the new `test-examples` check *without* the error boundary: the entire homepage went down. ### After - `pnpm --filter @lexical/website build` succeeds and the new `pnpm --filter @lexical/website test-examples` smoke check passes (7 editors mounted, no runtime errors, no broken examples). - Negative test: injected a client-only crash into one example — the build still succeeded, the error boundary isolated the failure (the other examples kept working), and `test-examples` failed with exit 1 naming the broken example. Reverted after verifying. - Unit tests pass for `LexicalUtils`, `LexicalNode`, `LexicalNodeState`, and `DecoratorTextExtension` (263 tests); eslint and prettier are clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
marked this pull request as ready for review
July 19, 2026 14:48
etrepum
requested review from
acywatson,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
July 19, 2026 14:48
… WebKit The `History` and `meta#1055 fast-typing-undo` specs flaked on the mac-plain/webkit suite: after an undo the assertion for an empty paragraph saw text that grew across retries (`h` → `he` → `hell`). On WebKit the input events dispatched by `keyboard.type()` can be applied after the call resolves, so the undo raced ahead of the typing and the still-queued input re-applied the text. The suite relies on `await assertHTML(...)` (which polls via `toPass`) as an implicit synchronization barrier that lets the editor settle between actions. Two gaps removed those barriers: - History.spec.mjs had five `assertHTML(...)` calls that were never awaited (floating promises), so the following undo/redo/type ran before the editor reached the asserted state. - The meta#1055 test typed `hello` and undid immediately with no assertion in between, so the undo could fire before the typing settled. Await the five assertions and add an intermediate assertion of the typed state before the first undo in meta#1055. No production code changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
etrepum
enabled auto-merge
July 19, 2026 17:54
potatowagon
approved these changes
Jul 21, 2026
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The website homepage crashed entirely with
nV (type tab) must implement a static clone method since its constructor has 1 required arguments (expecting 0), taking down every embedded example.Root cause: the website bundles the dev build of
lexical(so the node registration invariants are live) but minifies it for production. The minifier stripsarg = undefineddefault-parameter assignments, which inflatesFunction.lengthfor node constructors. The existingTextNode.length === 0guard detects non-ES6 compiler output but not a minified build —TextNode's owntext = ''default survives minification (''is notundefined) — so the clone/importJSONklass.length === 0invariants false-fired at runtime and crashed the first example to mount.This PR:
importJSONlength invariants when the build is unoptimized, detected viaTextNode.name === 'TextNode'(class names are mangled once the output is minified).@lexical/react'sLexicalErrorBoundary) so a single failing example no longer takes down the whole page. The fallback renders adata-example-errormarker.buildalone does not catch this class of failure.Closes #8860
Test plan
Before
pnpm --filter @lexical/website build) and loaded the homepage in Chromium: the first example threw the clone invariant and the page failed to render.test-examplescheck without the error boundary: the entire homepage went down.After
pnpm --filter @lexical/website buildsucceeds and the newpnpm --filter @lexical/website test-examplessmoke check passes (7 editors mounted, no runtime errors, no broken examples).test-examplesfailed with exit 1 naming the broken example. Reverted after verifying.LexicalUtils,LexicalNode,LexicalNodeState, andDecoratorTextExtension(263 tests); eslint and prettier are clean.