MCPcopy
hub / github.com/facebook/react / updateHostHoistable

Function updateHostHoistable

packages/react-reconciler/src/ReactFiberBeginWork.js:1999–2044  ·  view source on GitHub ↗
(
  current: null | Fiber,
  workInProgress: Fiber,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

1997}
1998
1999function updateHostHoistable(
2000 current: null | Fiber,
2001 workInProgress: Fiber,
2002 renderLanes: Lanes,
2003) {
2004 markRef(current, workInProgress);
2005
2006 if (current === null) {
2007 const resource = getResource(
2008 workInProgress.type,
2009 null,
2010 workInProgress.pendingProps,
2011 null,
2012 );
2013 if (resource) {
2014 workInProgress.memoizedState = resource;
2015 } else {
2016 if (!getIsHydrating()) {
2017 // This is not a Resource Hoistable and we aren't hydrating so we construct the instance.
2018 workInProgress.stateNode = createHoistableInstance(
2019 workInProgress.type,
2020 workInProgress.pendingProps,
2021 getRootHostContainer(),
2022 workInProgress,
2023 );
2024 }
2025 }
2026 } else {
2027 // Get Resource may or may not return a resource. either way we stash the result
2028 // on memoized state.
2029 workInProgress.memoizedState = getResource(
2030 workInProgress.type,
2031 current.memoizedProps,
2032 workInProgress.pendingProps,
2033 current.memoizedState,
2034 );
2035 }
2036
2037 // Resources never have reconciler managed children. It is possible for
2038 // the host implementation of getResource to consider children in the
2039 // resource construction but they will otherwise be discarded. In practice
2040 // this precludes all but the simplest children and Host specific warnings
2041 // should be implemented to warn when children are passsed when otherwise not
2042 // expected
2043 return null;
2044}
2045
2046function updateHostSingleton(
2047 current: Fiber | null,

Callers 1

beginWorkFunction · 0.85

Calls 4

getResourceFunction · 0.90
getIsHydratingFunction · 0.90
getRootHostContainerFunction · 0.90
markRefFunction · 0.85

Tested by

no test coverage detected