Skip to content

fix(payload-helper): Lexical Dependency#419

Merged
ainsleyclark merged 5 commits into
mainfrom
claude/fix-lexical-dependency-jsmw4
Feb 28, 2026
Merged

fix(payload-helper): Lexical Dependency#419
ainsleyclark merged 5 commits into
mainfrom
claude/fix-lexical-dependency-jsmw4

Conversation

@ainsleyclark
Copy link
Copy Markdown
Contributor

No description provided.

@payloadcms/richtext-lexical@3.74.0 pins lexical@0.35.0. Updated
@lexical/headless, @lexical/html and lexical in payload-helper from
0.39.0 to 0.35.0, and synced the root pnpm override to match.

https://claude.ai/code/session_01Enp5FVijpX51P4hxTpzpQw
Moves lexical, @lexical/headless and @lexical/html from dependencies
to peerDependencies with a >=0.35.0 floor. This lets consuming projects
inherit whichever lexical version their Payload install resolves,
eliminating version conflicts when upgrading Payload across repos.
Keeps concrete 0.35.0 pins in devDependencies for local builds.

https://claude.ai/code/session_01Enp5FVijpX51P4hxTpzpQw
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@claude

This comment has been minimized.

@claude

This comment has been minimized.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.26%. Comparing base (7f6b060) to head (58d303b).
⚠️ Report is 506 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #419      +/-   ##
==========================================
+ Coverage   64.59%   70.26%   +5.67%     
==========================================
  Files         154      187      +33     
  Lines        6064     7439    +1375     
==========================================
+ Hits         3917     5227    +1310     
+ Misses       2064     2012      -52     
- Partials       83      200     +117     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…enciesMeta

Prevents install warnings for consumers who don't explicitly list the
lexical packages, as they are satisfied transitively by Payload.

https://claude.ai/code/session_01Enp5FVijpX51P4hxTpzpQw
@claude
Copy link
Copy Markdown

claude Bot commented Feb 28, 2026

Review summary

  • Overall score: 7/10
  • Critical issues: 0
  • Warnings: 2
  • Suggestions: 2
  • Recommendation: ⚠️ Approve with comments

This PR correctly moves lexical and its @lexical/* sub-packages from direct dependencies to peerDependencies to avoid version conflicts when consuming projects already install Payload (which ships its own lexical). The approach is sound, but there are a few points worth addressing before merging.

Critical issues 🔴

None.

Warnings 🟡

1. Version downgrade from 0.39.0 → 0.35.0 may silently drop functionality

The package previously locked @lexical/headless and @lexical/html at 0.39.0 as direct dependencies. The devDependencies and the workspace override are now pinned to 0.35.0. If any internal code in payload-helper uses an API introduced between 0.35.0 and 0.39.0 (e.g. the @lexical/headless happy-dom integration that appeared in 0.39.0, or APIs from @lexical/extension), those call sites will silently break at runtime for consumers who resolve exactly 0.35.0. There is no note in the changeset or PR body explaining what drove the choice of 0.35.0 as the floor, nor any evidence that the package was tested against that version.

2. >=0.35.0 peer range is unbounded and may allow incompatible future versions

The declared peer range >=0.35.0 places no upper bound on the lexical version. Lexical has a history of breaking changes between minor versions (e.g. the @lexical/extension module only existed from 0.39.0 onward). A consuming project that ships lexical 0.40+ may silently encounter incompatibilities. A tighter range such as >=0.35.0 <1.0.0 or ^0.35.0 would be more defensive and conventional for a library package.

Suggestions 🟢

1. Add rationale to the changeset entry

The changeset message mentions that 0.35.0 aligns with @payloadcms/richtext-lexical@3.74.0, but the PR body is empty and the choice of floor version is not obvious to future maintainers. A sentence in the changeset explaining why 0.35.0 was chosen (e.g. it is the version bundled by Payload 3.74.0's richtext-lexical peer) would help.

2. Mark peers as optional: false if they are required for core functionality

lexical, @lexical/headless and @lexical/html are all marked optional: true in peerDependenciesMeta. If the rich-text serialisation helpers in payload-helper (e.g. anything converting Lexical state to HTML) require these at runtime, marking them optional means package managers will not warn consumers who omit them, leading to hard-to-diagnose runtime errors. Only mark a peer optional if the feature that depends on it is genuinely opt-in and the package degrades gracefully without it.


Scoring guide (1-10):

  • 9-10: Production ready, excellent quality
  • 7-8: Minor improvements needed, safe to merge
  • 5-6: Notable issues but functional
  • 3-4: Significant problems requiring fixes
  • 1-2: Critical issues, do not merge

@ainsleyclark ainsleyclark merged commit 9eb5cc1 into main Feb 28, 2026
4 checks passed
@ainsleyclark ainsleyclark deleted the claude/fix-lexical-dependency-jsmw4 branch February 28, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants