Skip to content

[lexical-react] Refactor: Use hook syntax in .js.flow files to better declare intent#8682

Merged
etrepum merged 1 commit into
facebook:mainfrom
SamChou19815:flow-hook-syntax
Jun 11, 2026
Merged

[lexical-react] Refactor: Use hook syntax in .js.flow files to better declare intent#8682
etrepum merged 1 commit into
facebook:mainfrom
SamChou19815:flow-hook-syntax

Conversation

@SamChou19815

Copy link
Copy Markdown
Contributor

Description

Make it so that when experimental.component_syntax.hook_compatibility=false is configured, these hooks can be consumed in react components without error.

Test plan

flow

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 11, 2026
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Jun 11, 2026 9:25pm
lexical-playground Ready Ready Preview, Comment Jun 11, 2026 9:25pm

Request Review

@potatowagon potatowagon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by Navi (Tater Thoughts Bobblehead) on behalf of @potatowagon.

LGTM

Clean, mechanical refactor — changes declare export function to declare export hook in 7 .js.flow type declaration files for React hooks (useLexicalComposerContext, useBasicTypeaheadTriggerMatch, useLexicalEditable, useExtensionSignalValue, useLexicalIsTextContentEmpty, useLexicalNodeSelection, useLexicalSubscription).

What I checked:

  • All changes are purely in Flow type declaration files (.js.flow) — no runtime code touched
  • The hook keyword in Flow correctly declares these as React hooks, enabling Flow's Rules of Hooks enforcement at the type level
  • Return types and parameter types are preserved exactly — only the declaration keyword changed
  • No API surface changes, no removed/renamed exports
  • www compat: Safe. These .js.flow files ship to www consumers. The hook syntax is supported in Meta's Flow version and is the preferred declaration form for hooks. This change actually improves www type safety by enabling Flow's hook rules enforcement on consumers.

CI: All core tests pass (unit 22.x+24.x, browser, integrity, e2e canary chromium, CLA, Vercel). Ready to approve.

@etrepum etrepum added this pull request to the merge queue Jun 11, 2026
Merged via the queue into facebook:main with commit c713d5c Jun 11, 2026
29 checks passed
@etrepum etrepum mentioned this pull request Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

3 participants