Skip to content

[BIX-8750]: Accept nullable block-skeleton scroll refs - #38

Merged
srubin merged 2 commits into
main-pojofrom
codex/react19-nullable-skeleton-refs
Sep 22, 2026
Merged

srubin merged 2 commits into
main-pojofrom
codex/react19-nullable-skeleton-refs

Conversation

@srubin

@srubin srubin commented Sep 22, 2026

Copy link
Copy Markdown

Summary

React 19 no longer includes null implicitly in RefObject<T>. Draft.js's block-skeleton options therefore reject the nullable scroll refs that Descript passes, although the hook already handles null by falling back to the editor contents element.

Accept RefObject<HTMLElement | null> in both options. This works with React 18 and React 19 without a custom compatibility type. Extend the existing skeleton-promotion test to exercise both mounted and null scroll refs. Production JavaScript is unchanged.

Related to BIX-8750 and descriptinc/descript#45317. No package release or Descript dependency bump is included.

Test Plan

  • Changed-file ESLint.
  • Editor suite: 14 tests passed.
  • Related suites: 28 suites, 242 tests, 271 snapshots passed.
  • Vite library build; checked the emitted declarations.
  • Consumer using the built declarations compiles against React 18 and React 19 types, including a nullable ref shared with a DOM element.
  • Descript client React 19 check using these built declarations: the Draft.js ref error is gone; three existing inert errors remain.
  • Compared emitted JavaScript before/after for both production files: identical. Live-app validation skipped for this type-only change.
  • I used AI.

The fork's plain source typecheck already fails on missing Node ambient types and newer standard-library APIs. With explicit Node types and ES2020 libraries, the React 18 source check passes. The equivalent React 19 source check retains three pre-existing callback-ref return errors in DraftEditorBlock, DraftEditorLeaf, and DraftEditorTextNode; those are outside this PR.

React 19 no longer includes null implicitly in RefObject<T>. Make null explicit in the public and hook options, matching the existing runtime fallback and remaining compatible with React 18.
@linear-code

linear-code Bot commented Sep 22, 2026

Copy link
Copy Markdown

BIX-8750

@srubin srubin self-assigned this Sep 22, 2026
@srubin
srubin marked this pull request as ready for review September 22, 2026 16:08
@srubin
srubin requested review from anjoola and paulinang and removed request for anjoola September 22, 2026 16:08
@srubin
srubin merged commit 44449c6 into main-pojo Sep 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants