reconciler docs: fix stale host config method signatures#36927
Conversation
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.
|
Hi @anxkhn! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
daltino
left a comment
There was a problem hiding this comment.
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.
|
Comparing: 5123b06...d75800b Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
The custom-renderer host config reference in
packages/react-reconciler/README.mddocuments 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.jsand the argumentsthe reconciler actually passes at each call site.
finalizeInitialChildren: drop the removedrootContainerparam->
finalizeInitialChildren(instance, type, props, hostContext)getChildHostContext: drop the removedrootContainerparam->
getChildHostContext(parentHostContext, type)preloadInstance: add the leadinginstanceparam->
preloadInstance(instance, type, props)suspendInstance: add the leadingsuspendedStateandinstanceparams->
suspendInstance(suspendedState, instance, type, props)waitForCommitToBeReady: document its params->
waitForCommitToBeReady(suspendedState, timeoutOffset)Background on the drift:
rootContainer(internallyrootContainerInstance) argument was removedfrom
finalizeInitialChildrenandgetChildHostContextin Remove rootContainerInstance from unnecessary places #25024; the READMEkept the old form.
instanceargument was added topreloadInstancein Add Suspensey Images behind a Flag #32819 (SuspenseyImages); the README kept the old two-argument form.
suspendInstanceandwaitForCommitToBeReadywere in the same Suspenseycluster 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
instancefordomElement, and existing headingsalready use
rootContainer,internalHandle,prevProps/nextProps). Thischange keeps that convention:
suspendedStatematches the reconciler's own localvariable name (the value returned by
startSuspendingCommitand threaded throughsuspendInstanceandwaitForCommitToBeReady).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:
finalizeInitialChildren(instance, type, props, hostContext)ReactFiberConfigDOM.jsfinalizeInitialChildren(4 params)ReactFiberCompleteWork.jspasses 4 argsgetChildHostContext(parentHostContext, type)ReactFiberConfigDOM.jsgetChildHostContext(2 params)ReactFiberHostContext.jsgetChildHostContext(context, fiber.type)preloadInstance(instance, type, props)ReactFiberConfigDOM.jspreloadInstance(3 params)ReactFiberCompleteWork.js/ReactFiberWorkLoop.jspassstateNode, type, propssuspendInstance(suspendedState, instance, type, props)ReactFiberConfigDOM.jssuspendInstance(4 params)ReactFiberCommitWork.jspassessuspendedState, instance, type, propswaitForCommitToBeReady(suspendedState, timeoutOffset)ReactFiberConfigDOM.jswaitForCommitToBeReady(2 params)ReactFiberWorkLoop.jspassessuspendedState, timeoutOffsetI also checked every other method heading in this README against its definition;
no other signature drift remains.
scripts/prettier/index.jsonly formatsjs/jsx/ts/tsx, so Markdown is notprettier-formatted here; running the changed-file formatter left the README
untouched.
yarn lintandyarn flowdo not apply to Markdown.