Skip to content

reconciler docs: fix stale host config method signatures#36927

Open
anxkhn wants to merge 2 commits into
react:mainfrom
anxkhn:docs/react-reconciler-host-config-signatures
Open

reconciler docs: fix stale host config method signatures#36927
anxkhn wants to merge 2 commits into
react:mainfrom
anxkhn:docs/react-reconciler-host-config-signatures

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

The custom-renderer host config reference in packages/react-reconciler/README.md
documents five method signatures whose parameter lists no longer match the actual
API. This updates the headings so they match the real signatures in
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js and the arguments
the reconciler actually passes at each call site.

  • finalizeInitialChildren: drop the removed rootContainer param
    -> finalizeInitialChildren(instance, type, props, hostContext)
  • getChildHostContext: drop the removed rootContainer param
    -> getChildHostContext(parentHostContext, type)
  • preloadInstance: add the leading instance param
    -> preloadInstance(instance, type, props)
  • suspendInstance: add the leading suspendedState and instance params
    -> suspendInstance(suspendedState, instance, type, props)
  • waitForCommitToBeReady: document its params
    -> waitForCommitToBeReady(suspendedState, timeoutOffset)

Background on the drift:

  • The rootContainer (internally rootContainerInstance) argument was removed
    from finalizeInitialChildren and getChildHostContext in Remove rootContainerInstance from unnecessary places #25024; the README
    kept the old form.
  • The instance argument was added to preloadInstance in Add Suspensey Images behind a Flag #32819 (Suspensey
    Images); the README kept the old two-argument form.
  • suspendInstance and waitForCommitToBeReady were in the same Suspensey
    cluster and had never had their real parameters documented.

The README uses friendly parameter names by convention rather than the DOM impl's
internal names (for example instance for domElement, and existing headings
already use rootContainer, internalHandle, prevProps/nextProps). This
change keeps that convention: suspendedState matches the reconciler's own local
variable name (the value returned by startSuspendingCommit and threaded through
suspendInstance and waitForCommitToBeReady).

This is documentation only; no code changes.

How did you test this change?

There is no automated test for a Markdown doc, so each corrected signature was
verified by hand against both the definition and the call sites:

Heading (updated) Definition Reconciler call site(s)
finalizeInitialChildren(instance, type, props, hostContext) ReactFiberConfigDOM.js finalizeInitialChildren (4 params) ReactFiberCompleteWork.js passes 4 args
getChildHostContext(parentHostContext, type) ReactFiberConfigDOM.js getChildHostContext (2 params) ReactFiberHostContext.js getChildHostContext(context, fiber.type)
preloadInstance(instance, type, props) ReactFiberConfigDOM.js preloadInstance (3 params) ReactFiberCompleteWork.js / ReactFiberWorkLoop.js pass stateNode, type, props
suspendInstance(suspendedState, instance, type, props) ReactFiberConfigDOM.js suspendInstance (4 params) ReactFiberCommitWork.js passes suspendedState, instance, type, props
waitForCommitToBeReady(suspendedState, timeoutOffset) ReactFiberConfigDOM.js waitForCommitToBeReady (2 params) ReactFiberWorkLoop.js passes suspendedState, timeoutOffset

I also checked every other method heading in this README against its definition;
no other signature drift remains.

scripts/prettier/index.js only formats js/jsx/ts/tsx, so Markdown is not
prettier-formatted here; running the changed-file formatter left the README
untouched. yarn lint and yarn flow do not apply to Markdown.

Update the react-reconciler custom-renderer host config reference so the
method signatures match the current API and the reconciler call sites:

- finalizeInitialChildren: drop the removed rootContainer param
  (instance, type, props, hostContext)
- getChildHostContext: drop the removed rootContainer param
  (parentHostContext, type)
- preloadInstance: add the leading instance param
  (instance, type, props)
- suspendInstance: add the leading suspendedState and instance params
  (suspendedState, instance, type, props)
- waitForCommitToBeReady: document its params
  (suspendedState, timeoutOffset)

Verified against packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
and the reconciler call sites in ReactFiberCompleteWork.js,
ReactFiberHostContext.js, ReactFiberWorkLoop.js, and ReactFiberCommitWork.js.
@meta-cla

meta-cla Bot commented Jul 5, 2026

Copy link
Copy Markdown

Hi @anxkhn!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Jul 5, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label Jul 5, 2026
@meta-cla

meta-cla Bot commented Jul 5, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@daltino daltino left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR updates the finalizeInitialChildren method signature in the react-reconciler documentation to better reflect its current implementation, removing a stale rootContainer parameter. The fix aligns the docs with the code and improves accuracy for contributors.

@anxkhn
anxkhn requested a review from daltino July 9, 2026 17:39
@react-sizebot

Copy link
Copy Markdown

Comparing: 5123b06...d75800b

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 7.19 kB 7.19 kB = 1.91 kB 1.91 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 614.54 kB 614.54 kB = 108.61 kB 108.61 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 7.19 kB 7.19 kB = 1.91 kB 1.91 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 685.73 kB 685.73 kB = 120.11 kB 120.11 kB
facebook-www/ReactDOM-prod.classic.js = 706.08 kB 706.08 kB = 123.69 kB 123.69 kB
facebook-www/ReactDOM-prod.modern.js = 696.39 kB 696.39 kB = 122.07 kB 122.07 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against d75800b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants