How to use pushContextProvider method in Playwright Internal

Best JavaScript code snippet using playwright-internal

b0ea876b301f63c96d702a493f5ebd456144bcReactFiberBeginWork.js

Source:b0ea876b301f63c96d702a493f5ebd456144bcReactFiberBeginWork.js Github

copy

Full Screen

...139 memoizeProps(workInProgress, nextProps);140 return workInProgress.child;141 }142 function updateClassComponent(current, workInProgress, priorityLevel) {143 var hasContext = pushContextProvider(workInProgress);144 var shouldUpdate = void 0;145 if (current === null) {146 if (!workInProgress.stateNode) {147 constructClassInstance(workInProgress);148 mountClassInstance(workInProgress, priorityLevel);149 shouldUpdate = true;150 } else {151 shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel);152 }153 } else {154 shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel);155 }156 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);157 }158 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {159 markRef(current, workInProgress);160 if (!shouldUpdate) {161 return bailoutOnAlreadyFinishedWork(current, workInProgress);162 }163 var instance = workInProgress.stateNode;164 ReactCurrentOwner.current = workInProgress;165 var nextChildren = void 0;166 if (__DEV__) {167 ReactDebugCurrentFiber.phase = 'render';168 nextChildren = instance.render();169 ReactDebugCurrentFiber.phase = null;170 } else {171 nextChildren = instance.render();172 }173 reconcileChildren(current, workInProgress, nextChildren);174 memoizeState(workInProgress, instance.state);175 memoizeProps(workInProgress, instance.props);176 if (hasContext) {177 invalidateContextProvider(workInProgress);178 }179 return workInProgress.child;180 }181 function updateHostRoot(current, workInProgress, priorityLevel) {182 var root = workInProgress.stateNode;183 if (root.pendingContext) {184 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);185 } else if (root.context) {186 pushTopLevelContextObject(workInProgress, root.context, false);187 }188 pushHostContainer(workInProgress, root.containerInfo);189 var updateQueue = workInProgress.updateQueue;190 if (updateQueue !== null) {191 var prevState = workInProgress.memoizedState;192 var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);193 if (prevState === state) {194 return bailoutOnAlreadyFinishedWork(current, workInProgress);195 }196 var element = state.element;197 reconcileChildren(current, workInProgress, element);198 memoizeState(workInProgress, state);199 return workInProgress.child;200 }201 return bailoutOnAlreadyFinishedWork(current, workInProgress);202 }203 function updateHostComponent(current, workInProgress) {204 pushHostContext(workInProgress);205 var nextProps = workInProgress.pendingProps;206 var prevProps = current !== null ? current.memoizedProps : null;207 var memoizedProps = workInProgress.memoizedProps;208 if (hasContextChanged()) {209 if (nextProps === null) {210 nextProps = memoizedProps;211 invariant(nextProps !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');212 }213 } else if (nextProps === null || memoizedProps === nextProps) {214 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {215 var child = workInProgress.progressedChild;216 while (child !== null) {217 child.pendingWorkPriority = OffscreenPriority;218 child = child.sibling;219 }220 return null;221 }222 return bailoutOnAlreadyFinishedWork(current, workInProgress);223 }224 var nextChildren = nextProps.children;225 var isDirectTextChild = shouldSetTextContent(nextProps);226 if (isDirectTextChild) {227 nextChildren = null;228 } else if (prevProps && shouldSetTextContent(prevProps)) {229 workInProgress.effectTag |= ContentReset;230 }231 markRef(current, workInProgress);232 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {233 if (workInProgress.progressedPriority === OffscreenPriority) {234 workInProgress.child = workInProgress.progressedChild;235 }236 reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority);237 memoizeProps(workInProgress, nextProps);238 workInProgress.child = current !== null ? current.child : null;239 if (current === null) {240 var _child = workInProgress.progressedChild;241 while (_child !== null) {242 _child.effectTag = Placement;243 _child = _child.sibling;244 }245 }246 return null;247 } else {248 reconcileChildren(current, workInProgress, nextChildren);249 memoizeProps(workInProgress, nextProps);250 return workInProgress.child;251 }252 }253 function updateHostText(current, workInProgress) {254 var nextProps = workInProgress.pendingProps;255 if (nextProps === null) {256 nextProps = workInProgress.memoizedProps;257 }258 memoizeProps(workInProgress, nextProps);259 return null;260 }261 function mountIndeterminateComponent(current, workInProgress, priorityLevel) {262 invariant(current === null, 'An indeterminate component should never have mounted. This error is ' + 'likely caused by a bug in React. Please file an issue.');263 var fn = workInProgress.type;264 var props = workInProgress.pendingProps;265 var unmaskedContext = getUnmaskedContext(workInProgress);266 var context = getMaskedContext(workInProgress, unmaskedContext);267 var value;268 if (__DEV__) {269 ReactCurrentOwner.current = workInProgress;270 value = fn(props, context);271 } else {272 value = fn(props, context);273 }274 if (typeof value === 'object' && value !== null && typeof value.render === 'function') {275 workInProgress.tag = ClassComponent;276 var hasContext = pushContextProvider(workInProgress);277 adoptClassInstance(workInProgress, value);278 mountClassInstance(workInProgress, priorityLevel);279 return finishClassComponent(current, workInProgress, true, hasContext);280 } else {281 workInProgress.tag = FunctionalComponent;282 if (__DEV__) {283 var Component = workInProgress.type;284 if (Component) {285 warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');286 }287 if (workInProgress.ref !== null) {288 var info = '';289 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();290 if (ownerName) {291 info += '\n\nCheck the render method of `' + ownerName + '`.';292 }293 var warningKey = ownerName || workInProgress._debugID || '';294 var debugSource = workInProgress._debugSource;295 if (debugSource) {296 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;297 }298 if (!warnedAboutStatelessRefs[warningKey]) {299 warnedAboutStatelessRefs[warningKey] = true;300 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());301 }302 }303 }304 reconcileChildren(current, workInProgress, value);305 memoizeProps(workInProgress, props);306 return workInProgress.child;307 }308 }309 function updateCoroutineComponent(current, workInProgress) {310 var nextCoroutine = workInProgress.pendingProps;311 if (hasContextChanged()) {312 if (nextCoroutine === null) {313 nextCoroutine = current && current.memoizedProps;314 invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');315 }316 } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {317 nextCoroutine = workInProgress.memoizedProps;318 }319 var nextChildren = nextCoroutine.children;320 var priorityLevel = workInProgress.pendingWorkPriority;321 workInProgress.memoizedProps = null;322 if (current === null) {323 workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);324 } else if (current.child === workInProgress.child) {325 clearDeletions(workInProgress);326 workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);327 transferDeletions(workInProgress);328 } else {329 workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);330 transferDeletions(workInProgress);331 }332 memoizeProps(workInProgress, nextCoroutine);333 return workInProgress.stateNode;334 }335 function updatePortalComponent(current, workInProgress) {336 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);337 var priorityLevel = workInProgress.pendingWorkPriority;338 var nextChildren = workInProgress.pendingProps;339 if (hasContextChanged()) {340 if (nextChildren === null) {341 nextChildren = current && current.memoizedProps;342 invariant(nextChildren != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');343 }344 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {345 return bailoutOnAlreadyFinishedWork(current, workInProgress);346 }347 if (current === null) {348 workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);349 memoizeProps(workInProgress, nextChildren);350 markChildAsProgressed(current, workInProgress, priorityLevel);351 } else {352 reconcileChildren(current, workInProgress, nextChildren);353 memoizeProps(workInProgress, nextChildren);354 }355 return workInProgress.child;356 }357 function bailoutOnAlreadyFinishedWork(current, workInProgress) {358 if (__DEV__) {359 cancelWorkTimer(workInProgress);360 }361 var priorityLevel = workInProgress.pendingWorkPriority;362 if (current && workInProgress.child === current.child) {363 clearDeletions(workInProgress);364 }365 cloneChildFibers(current, workInProgress);366 markChildAsProgressed(current, workInProgress, priorityLevel);367 return workInProgress.child;368 }369 function bailoutOnLowPriority(current, workInProgress) {370 if (__DEV__) {371 cancelWorkTimer(workInProgress);372 }373 switch (workInProgress.tag) {374 case ClassComponent:375 pushContextProvider(workInProgress);376 break;377 case HostPortal:378 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);379 break;380 }381 return null;382 }383 function memoizeProps(workInProgress, nextProps) {384 workInProgress.memoizedProps = nextProps;385 workInProgress.pendingProps = null;386 }387 function memoizeState(workInProgress, nextState) {388 workInProgress.memoizedState = nextState;389 }...

Full Screen

Full Screen

a9c9772a1f3ee8b9618c4d3bc7e33597822442ReactFiberBeginWork.js

Source:a9c9772a1f3ee8b9618c4d3bc7e33597822442ReactFiberBeginWork.js Github

copy

Full Screen

...139 memoizeProps(workInProgress, nextProps);140 return workInProgress.child;141 }142 function updateClassComponent(current, workInProgress, priorityLevel) {143 var hasContext = pushContextProvider(workInProgress);144 var shouldUpdate = void 0;145 if (current === null) {146 if (!workInProgress.stateNode) {147 constructClassInstance(workInProgress);148 mountClassInstance(workInProgress, priorityLevel);149 shouldUpdate = true;150 } else {151 shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel);152 }153 } else {154 shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel);155 }156 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);157 }158 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {159 markRef(current, workInProgress);160 if (!shouldUpdate) {161 return bailoutOnAlreadyFinishedWork(current, workInProgress);162 }163 var instance = workInProgress.stateNode;164 ReactCurrentOwner.current = workInProgress;165 var nextChildren = void 0;166 if (__DEV__) {167 ReactDebugCurrentFiber.phase = 'render';168 nextChildren = instance.render();169 ReactDebugCurrentFiber.phase = null;170 } else {171 nextChildren = instance.render();172 }173 reconcileChildren(current, workInProgress, nextChildren);174 memoizeState(workInProgress, instance.state);175 memoizeProps(workInProgress, instance.props);176 if (hasContext) {177 invalidateContextProvider(workInProgress);178 }179 return workInProgress.child;180 }181 function updateHostRoot(current, workInProgress, priorityLevel) {182 var root = workInProgress.stateNode;183 if (root.pendingContext) {184 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);185 } else if (root.context) {186 pushTopLevelContextObject(workInProgress, root.context, false);187 }188 pushHostContainer(workInProgress, root.containerInfo);189 var updateQueue = workInProgress.updateQueue;190 if (updateQueue !== null) {191 var prevState = workInProgress.memoizedState;192 var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);193 if (prevState === state) {194 return bailoutOnAlreadyFinishedWork(current, workInProgress);195 }196 var element = state.element;197 reconcileChildren(current, workInProgress, element);198 memoizeState(workInProgress, state);199 return workInProgress.child;200 }201 return bailoutOnAlreadyFinishedWork(current, workInProgress);202 }203 function updateHostComponent(current, workInProgress) {204 pushHostContext(workInProgress);205 var nextProps = workInProgress.pendingProps;206 var prevProps = current !== null ? current.memoizedProps : null;207 var memoizedProps = workInProgress.memoizedProps;208 if (hasContextChanged()) {209 if (nextProps === null) {210 nextProps = memoizedProps;211 invariant(nextProps !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');212 }213 } else if (nextProps === null || memoizedProps === nextProps) {214 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {215 var child = workInProgress.progressedChild;216 while (child !== null) {217 child.pendingWorkPriority = OffscreenPriority;218 child = child.sibling;219 }220 return null;221 }222 return bailoutOnAlreadyFinishedWork(current, workInProgress);223 }224 var nextChildren = nextProps.children;225 var isDirectTextChild = shouldSetTextContent(nextProps);226 if (isDirectTextChild) {227 nextChildren = null;228 } else if (prevProps && shouldSetTextContent(prevProps)) {229 workInProgress.effectTag |= ContentReset;230 }231 markRef(current, workInProgress);232 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {233 if (workInProgress.progressedPriority === OffscreenPriority) {234 workInProgress.child = workInProgress.progressedChild;235 }236 reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority);237 memoizeProps(workInProgress, nextProps);238 workInProgress.child = current !== null ? current.child : null;239 if (current === null) {240 var _child = workInProgress.progressedChild;241 while (_child !== null) {242 _child.effectTag = Placement;243 _child = _child.sibling;244 }245 }246 return null;247 } else {248 reconcileChildren(current, workInProgress, nextChildren);249 memoizeProps(workInProgress, nextProps);250 return workInProgress.child;251 }252 }253 function updateHostText(current, workInProgress) {254 var nextProps = workInProgress.pendingProps;255 if (nextProps === null) {256 nextProps = workInProgress.memoizedProps;257 }258 memoizeProps(workInProgress, nextProps);259 return null;260 }261 function mountIndeterminateComponent(current, workInProgress, priorityLevel) {262 invariant(current === null, 'An indeterminate component should never have mounted. This error is ' + 'likely caused by a bug in React. Please file an issue.');263 var fn = workInProgress.type;264 var props = workInProgress.pendingProps;265 var unmaskedContext = getUnmaskedContext(workInProgress);266 var context = getMaskedContext(workInProgress, unmaskedContext);267 var value;268 if (__DEV__) {269 ReactCurrentOwner.current = workInProgress;270 value = fn(props, context);271 } else {272 value = fn(props, context);273 }274 if (typeof value === 'object' && value !== null && typeof value.render === 'function') {275 workInProgress.tag = ClassComponent;276 var hasContext = pushContextProvider(workInProgress);277 adoptClassInstance(workInProgress, value);278 mountClassInstance(workInProgress, priorityLevel);279 return finishClassComponent(current, workInProgress, true, hasContext);280 } else {281 workInProgress.tag = FunctionalComponent;282 if (__DEV__) {283 var Component = workInProgress.type;284 if (Component) {285 warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');286 }287 if (workInProgress.ref !== null) {288 var info = '';289 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();290 if (ownerName) {291 info += '\n\nCheck the render method of `' + ownerName + '`.';292 }293 var warningKey = ownerName || workInProgress._debugID || '';294 var debugSource = workInProgress._debugSource;295 if (debugSource) {296 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;297 }298 if (!warnedAboutStatelessRefs[warningKey]) {299 warnedAboutStatelessRefs[warningKey] = true;300 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());301 }302 }303 }304 reconcileChildren(current, workInProgress, value);305 memoizeProps(workInProgress, props);306 return workInProgress.child;307 }308 }309 function updateCoroutineComponent(current, workInProgress) {310 var nextCoroutine = workInProgress.pendingProps;311 if (hasContextChanged()) {312 if (nextCoroutine === null) {313 nextCoroutine = current && current.memoizedProps;314 invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');315 }316 } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {317 nextCoroutine = workInProgress.memoizedProps;318 }319 var nextChildren = nextCoroutine.children;320 var priorityLevel = workInProgress.pendingWorkPriority;321 workInProgress.memoizedProps = null;322 if (current === null) {323 workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);324 } else if (current.child === workInProgress.child) {325 clearDeletions(workInProgress);326 workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);327 transferDeletions(workInProgress);328 } else {329 workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);330 transferDeletions(workInProgress);331 }332 memoizeProps(workInProgress, nextCoroutine);333 return workInProgress.stateNode;334 }335 function updatePortalComponent(current, workInProgress) {336 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);337 var priorityLevel = workInProgress.pendingWorkPriority;338 var nextChildren = workInProgress.pendingProps;339 if (hasContextChanged()) {340 if (nextChildren === null) {341 nextChildren = current && current.memoizedProps;342 invariant(nextChildren != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');343 }344 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {345 return bailoutOnAlreadyFinishedWork(current, workInProgress);346 }347 if (current === null) {348 workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);349 memoizeProps(workInProgress, nextChildren);350 markChildAsProgressed(current, workInProgress, priorityLevel);351 } else {352 reconcileChildren(current, workInProgress, nextChildren);353 memoizeProps(workInProgress, nextChildren);354 }355 return workInProgress.child;356 }357 function bailoutOnAlreadyFinishedWork(current, workInProgress) {358 if (__DEV__) {359 cancelWorkTimer(workInProgress);360 }361 var priorityLevel = workInProgress.pendingWorkPriority;362 if (current && workInProgress.child === current.child) {363 clearDeletions(workInProgress);364 }365 cloneChildFibers(current, workInProgress);366 markChildAsProgressed(current, workInProgress, priorityLevel);367 return workInProgress.child;368 }369 function bailoutOnLowPriority(current, workInProgress) {370 if (__DEV__) {371 cancelWorkTimer(workInProgress);372 }373 switch (workInProgress.tag) {374 case ClassComponent:375 pushContextProvider(workInProgress);376 break;377 case HostPortal:378 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);379 break;380 }381 return null;382 }383 function memoizeProps(workInProgress, nextProps) {384 workInProgress.memoizedProps = nextProps;385 workInProgress.pendingProps = null;386 }387 function memoizeState(workInProgress, nextState) {388 workInProgress.memoizedState = nextState;389 }...

Full Screen

Full Screen

0c0973fc7971824d7f8a174e5eae9c482a6244ReactFiberBeginWork.js

Source:0c0973fc7971824d7f8a174e5eae9c482a6244ReactFiberBeginWork.js Github

copy

Full Screen

...139 memoizeProps(workInProgress, nextProps);140 return workInProgress.child;141 }142 function updateClassComponent(current, workInProgress, priorityLevel) {143 var hasContext = pushContextProvider(workInProgress);144 var shouldUpdate = void 0;145 if (current === null) {146 if (!workInProgress.stateNode) {147 constructClassInstance(workInProgress);148 mountClassInstance(workInProgress, priorityLevel);149 shouldUpdate = true;150 } else {151 shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel);152 }153 } else {154 shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel);155 }156 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);157 }158 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {159 markRef(current, workInProgress);160 if (!shouldUpdate) {161 return bailoutOnAlreadyFinishedWork(current, workInProgress);162 }163 var instance = workInProgress.stateNode;164 ReactCurrentOwner.current = workInProgress;165 var nextChildren = void 0;166 if (__DEV__) {167 ReactDebugCurrentFiber.phase = 'render';168 nextChildren = instance.render();169 ReactDebugCurrentFiber.phase = null;170 } else {171 nextChildren = instance.render();172 }173 reconcileChildren(current, workInProgress, nextChildren);174 memoizeState(workInProgress, instance.state);175 memoizeProps(workInProgress, instance.props);176 if (hasContext) {177 invalidateContextProvider(workInProgress);178 }179 return workInProgress.child;180 }181 function updateHostRoot(current, workInProgress, priorityLevel) {182 var root = workInProgress.stateNode;183 if (root.pendingContext) {184 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);185 } else if (root.context) {186 pushTopLevelContextObject(workInProgress, root.context, false);187 }188 pushHostContainer(workInProgress, root.containerInfo);189 var updateQueue = workInProgress.updateQueue;190 if (updateQueue !== null) {191 var prevState = workInProgress.memoizedState;192 var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);193 if (prevState === state) {194 return bailoutOnAlreadyFinishedWork(current, workInProgress);195 }196 var element = state.element;197 reconcileChildren(current, workInProgress, element);198 memoizeState(workInProgress, state);199 return workInProgress.child;200 }201 return bailoutOnAlreadyFinishedWork(current, workInProgress);202 }203 function updateHostComponent(current, workInProgress) {204 pushHostContext(workInProgress);205 var nextProps = workInProgress.pendingProps;206 var prevProps = current !== null ? current.memoizedProps : null;207 var memoizedProps = workInProgress.memoizedProps;208 if (hasContextChanged()) {209 if (nextProps === null) {210 nextProps = memoizedProps;211 invariant(nextProps !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');212 }213 } else if (nextProps === null || memoizedProps === nextProps) {214 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {215 var child = workInProgress.progressedChild;216 while (child !== null) {217 child.pendingWorkPriority = OffscreenPriority;218 child = child.sibling;219 }220 return null;221 }222 return bailoutOnAlreadyFinishedWork(current, workInProgress);223 }224 var nextChildren = nextProps.children;225 var isDirectTextChild = shouldSetTextContent(nextProps);226 if (isDirectTextChild) {227 nextChildren = null;228 } else if (prevProps && shouldSetTextContent(prevProps)) {229 workInProgress.effectTag |= ContentReset;230 }231 markRef(current, workInProgress);232 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {233 if (workInProgress.progressedPriority === OffscreenPriority) {234 workInProgress.child = workInProgress.progressedChild;235 }236 reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority);237 memoizeProps(workInProgress, nextProps);238 workInProgress.child = current !== null ? current.child : null;239 if (current === null) {240 var _child = workInProgress.progressedChild;241 while (_child !== null) {242 _child.effectTag = Placement;243 _child = _child.sibling;244 }245 }246 return null;247 } else {248 reconcileChildren(current, workInProgress, nextChildren);249 memoizeProps(workInProgress, nextProps);250 return workInProgress.child;251 }252 }253 function updateHostText(current, workInProgress) {254 var nextProps = workInProgress.pendingProps;255 if (nextProps === null) {256 nextProps = workInProgress.memoizedProps;257 }258 memoizeProps(workInProgress, nextProps);259 return null;260 }261 function mountIndeterminateComponent(current, workInProgress, priorityLevel) {262 invariant(current === null, 'An indeterminate component should never have mounted. This error is ' + 'likely caused by a bug in React. Please file an issue.');263 var fn = workInProgress.type;264 var props = workInProgress.pendingProps;265 var unmaskedContext = getUnmaskedContext(workInProgress);266 var context = getMaskedContext(workInProgress, unmaskedContext);267 var value;268 if (__DEV__) {269 ReactCurrentOwner.current = workInProgress;270 value = fn(props, context);271 } else {272 value = fn(props, context);273 }274 if (typeof value === 'object' && value !== null && typeof value.render === 'function') {275 workInProgress.tag = ClassComponent;276 var hasContext = pushContextProvider(workInProgress);277 adoptClassInstance(workInProgress, value);278 mountClassInstance(workInProgress, priorityLevel);279 return finishClassComponent(current, workInProgress, true, hasContext);280 } else {281 workInProgress.tag = FunctionalComponent;282 if (__DEV__) {283 var Component = workInProgress.type;284 if (Component) {285 warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');286 }287 if (workInProgress.ref !== null) {288 var info = '';289 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();290 if (ownerName) {291 info += '\n\nCheck the render method of `' + ownerName + '`.';292 }293 var warningKey = ownerName || workInProgress._debugID || '';294 var debugSource = workInProgress._debugSource;295 if (debugSource) {296 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;297 }298 if (!warnedAboutStatelessRefs[warningKey]) {299 warnedAboutStatelessRefs[warningKey] = true;300 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());301 }302 }303 }304 reconcileChildren(current, workInProgress, value);305 memoizeProps(workInProgress, props);306 return workInProgress.child;307 }308 }309 function updateCoroutineComponent(current, workInProgress) {310 var nextCoroutine = workInProgress.pendingProps;311 if (hasContextChanged()) {312 if (nextCoroutine === null) {313 nextCoroutine = current && current.memoizedProps;314 invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');315 }316 } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {317 nextCoroutine = workInProgress.memoizedProps;318 }319 var nextChildren = nextCoroutine.children;320 var priorityLevel = workInProgress.pendingWorkPriority;321 workInProgress.memoizedProps = null;322 if (current === null) {323 workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);324 } else if (current.child === workInProgress.child) {325 clearDeletions(workInProgress);326 workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);327 transferDeletions(workInProgress);328 } else {329 workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);330 transferDeletions(workInProgress);331 }332 memoizeProps(workInProgress, nextCoroutine);333 return workInProgress.stateNode;334 }335 function updatePortalComponent(current, workInProgress) {336 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);337 var priorityLevel = workInProgress.pendingWorkPriority;338 var nextChildren = workInProgress.pendingProps;339 if (hasContextChanged()) {340 if (nextChildren === null) {341 nextChildren = current && current.memoizedProps;342 invariant(nextChildren != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');343 }344 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {345 return bailoutOnAlreadyFinishedWork(current, workInProgress);346 }347 if (current === null) {348 workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);349 memoizeProps(workInProgress, nextChildren);350 markChildAsProgressed(current, workInProgress, priorityLevel);351 } else {352 reconcileChildren(current, workInProgress, nextChildren);353 memoizeProps(workInProgress, nextChildren);354 }355 return workInProgress.child;356 }357 function bailoutOnAlreadyFinishedWork(current, workInProgress) {358 if (__DEV__) {359 cancelWorkTimer(workInProgress);360 }361 var priorityLevel = workInProgress.pendingWorkPriority;362 if (current && workInProgress.child === current.child) {363 clearDeletions(workInProgress);364 }365 cloneChildFibers(current, workInProgress);366 markChildAsProgressed(current, workInProgress, priorityLevel);367 return workInProgress.child;368 }369 function bailoutOnLowPriority(current, workInProgress) {370 if (__DEV__) {371 cancelWorkTimer(workInProgress);372 }373 switch (workInProgress.tag) {374 case ClassComponent:375 pushContextProvider(workInProgress);376 break;377 case HostPortal:378 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);379 break;380 }381 return null;382 }383 function memoizeProps(workInProgress, nextProps) {384 workInProgress.memoizedProps = nextProps;385 workInProgress.pendingProps = null;386 }387 function memoizeState(workInProgress, nextState) {388 workInProgress.memoizedState = nextState;389 }...

Full Screen

Full Screen

5ecaac3714568df47d1bdc3115b642621abd87ReactFiberBeginWork.js

Source:5ecaac3714568df47d1bdc3115b642621abd87ReactFiberBeginWork.js Github

copy

Full Screen

...139 memoizeProps(workInProgress, nextProps);140 return workInProgress.child;141 }142 function updateClassComponent(current, workInProgress, priorityLevel) {143 var hasContext = pushContextProvider(workInProgress);144 var shouldUpdate = void 0;145 if (current === null) {146 if (!workInProgress.stateNode) {147 constructClassInstance(workInProgress);148 mountClassInstance(workInProgress, priorityLevel);149 shouldUpdate = true;150 } else {151 shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel);152 }153 } else {154 shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel);155 }156 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);157 }158 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {159 markRef(current, workInProgress);160 if (!shouldUpdate) {161 return bailoutOnAlreadyFinishedWork(current, workInProgress);162 }163 var instance = workInProgress.stateNode;164 ReactCurrentOwner.current = workInProgress;165 var nextChildren = void 0;166 if (__DEV__) {167 ReactDebugCurrentFiber.phase = 'render';168 nextChildren = instance.render();169 ReactDebugCurrentFiber.phase = null;170 } else {171 nextChildren = instance.render();172 }173 reconcileChildren(current, workInProgress, nextChildren);174 memoizeState(workInProgress, instance.state);175 memoizeProps(workInProgress, instance.props);176 if (hasContext) {177 invalidateContextProvider(workInProgress);178 }179 return workInProgress.child;180 }181 function updateHostRoot(current, workInProgress, priorityLevel) {182 var root = workInProgress.stateNode;183 if (root.pendingContext) {184 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);185 } else if (root.context) {186 pushTopLevelContextObject(workInProgress, root.context, false);187 }188 pushHostContainer(workInProgress, root.containerInfo);189 var updateQueue = workInProgress.updateQueue;190 if (updateQueue !== null) {191 var prevState = workInProgress.memoizedState;192 var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);193 if (prevState === state) {194 return bailoutOnAlreadyFinishedWork(current, workInProgress);195 }196 var element = state.element;197 reconcileChildren(current, workInProgress, element);198 memoizeState(workInProgress, state);199 return workInProgress.child;200 }201 return bailoutOnAlreadyFinishedWork(current, workInProgress);202 }203 function updateHostComponent(current, workInProgress) {204 pushHostContext(workInProgress);205 var nextProps = workInProgress.pendingProps;206 var prevProps = current !== null ? current.memoizedProps : null;207 var memoizedProps = workInProgress.memoizedProps;208 if (hasContextChanged()) {209 if (nextProps === null) {210 nextProps = memoizedProps;211 invariant(nextProps !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');212 }213 } else if (nextProps === null || memoizedProps === nextProps) {214 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {215 var child = workInProgress.progressedChild;216 while (child !== null) {217 child.pendingWorkPriority = OffscreenPriority;218 child = child.sibling;219 }220 return null;221 }222 return bailoutOnAlreadyFinishedWork(current, workInProgress);223 }224 var nextChildren = nextProps.children;225 var isDirectTextChild = shouldSetTextContent(nextProps);226 if (isDirectTextChild) {227 nextChildren = null;228 } else if (prevProps && shouldSetTextContent(prevProps)) {229 workInProgress.effectTag |= ContentReset;230 }231 markRef(current, workInProgress);232 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {233 if (workInProgress.progressedPriority === OffscreenPriority) {234 workInProgress.child = workInProgress.progressedChild;235 }236 reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority);237 memoizeProps(workInProgress, nextProps);238 workInProgress.child = current !== null ? current.child : null;239 if (current === null) {240 var _child = workInProgress.progressedChild;241 while (_child !== null) {242 _child.effectTag = Placement;243 _child = _child.sibling;244 }245 }246 return null;247 } else {248 reconcileChildren(current, workInProgress, nextChildren);249 memoizeProps(workInProgress, nextProps);250 return workInProgress.child;251 }252 }253 function updateHostText(current, workInProgress) {254 var nextProps = workInProgress.pendingProps;255 if (nextProps === null) {256 nextProps = workInProgress.memoizedProps;257 }258 memoizeProps(workInProgress, nextProps);259 return null;260 }261 function mountIndeterminateComponent(current, workInProgress, priorityLevel) {262 invariant(current === null, 'An indeterminate component should never have mounted. This error is ' + 'likely caused by a bug in React. Please file an issue.');263 var fn = workInProgress.type;264 var props = workInProgress.pendingProps;265 var unmaskedContext = getUnmaskedContext(workInProgress);266 var context = getMaskedContext(workInProgress, unmaskedContext);267 var value;268 if (__DEV__) {269 ReactCurrentOwner.current = workInProgress;270 value = fn(props, context);271 } else {272 value = fn(props, context);273 }274 if (typeof value === 'object' && value !== null && typeof value.render === 'function') {275 workInProgress.tag = ClassComponent;276 var hasContext = pushContextProvider(workInProgress);277 adoptClassInstance(workInProgress, value);278 mountClassInstance(workInProgress, priorityLevel);279 return finishClassComponent(current, workInProgress, true, hasContext);280 } else {281 workInProgress.tag = FunctionalComponent;282 if (__DEV__) {283 var Component = workInProgress.type;284 if (Component) {285 warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');286 }287 if (workInProgress.ref !== null) {288 var info = '';289 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();290 if (ownerName) {291 info += '\n\nCheck the render method of `' + ownerName + '`.';292 }293 var warningKey = ownerName || workInProgress._debugID || '';294 var debugSource = workInProgress._debugSource;295 if (debugSource) {296 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;297 }298 if (!warnedAboutStatelessRefs[warningKey]) {299 warnedAboutStatelessRefs[warningKey] = true;300 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());301 }302 }303 }304 reconcileChildren(current, workInProgress, value);305 memoizeProps(workInProgress, props);306 return workInProgress.child;307 }308 }309 function updateCoroutineComponent(current, workInProgress) {310 var nextCoroutine = workInProgress.pendingProps;311 if (hasContextChanged()) {312 if (nextCoroutine === null) {313 nextCoroutine = current && current.memoizedProps;314 invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');315 }316 } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {317 nextCoroutine = workInProgress.memoizedProps;318 }319 var nextChildren = nextCoroutine.children;320 var priorityLevel = workInProgress.pendingWorkPriority;321 workInProgress.memoizedProps = null;322 if (current === null) {323 workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);324 } else if (current.child === workInProgress.child) {325 clearDeletions(workInProgress);326 workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);327 transferDeletions(workInProgress);328 } else {329 workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);330 transferDeletions(workInProgress);331 }332 memoizeProps(workInProgress, nextCoroutine);333 return workInProgress.stateNode;334 }335 function updatePortalComponent(current, workInProgress) {336 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);337 var priorityLevel = workInProgress.pendingWorkPriority;338 var nextChildren = workInProgress.pendingProps;339 if (hasContextChanged()) {340 if (nextChildren === null) {341 nextChildren = current && current.memoizedProps;342 invariant(nextChildren != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');343 }344 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {345 return bailoutOnAlreadyFinishedWork(current, workInProgress);346 }347 if (current === null) {348 workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);349 memoizeProps(workInProgress, nextChildren);350 markChildAsProgressed(current, workInProgress, priorityLevel);351 } else {352 reconcileChildren(current, workInProgress, nextChildren);353 memoizeProps(workInProgress, nextChildren);354 }355 return workInProgress.child;356 }357 function bailoutOnAlreadyFinishedWork(current, workInProgress) {358 if (__DEV__) {359 cancelWorkTimer(workInProgress);360 }361 var priorityLevel = workInProgress.pendingWorkPriority;362 if (current && workInProgress.child === current.child) {363 clearDeletions(workInProgress);364 }365 cloneChildFibers(current, workInProgress);366 markChildAsProgressed(current, workInProgress, priorityLevel);367 return workInProgress.child;368 }369 function bailoutOnLowPriority(current, workInProgress) {370 if (__DEV__) {371 cancelWorkTimer(workInProgress);372 }373 switch (workInProgress.tag) {374 case ClassComponent:375 pushContextProvider(workInProgress);376 break;377 case HostPortal:378 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);379 break;380 }381 return null;382 }383 function memoizeProps(workInProgress, nextProps) {384 workInProgress.memoizedProps = nextProps;385 workInProgress.pendingProps = null;386 }387 function memoizeState(workInProgress, nextState) {388 workInProgress.memoizedState = nextState;389 }...

Full Screen

Full Screen

8a2b1d695be0826d1657ee10d51695117eb487ReactFiberBeginWork.js

Source:8a2b1d695be0826d1657ee10d51695117eb487ReactFiberBeginWork.js Github

copy

Full Screen

...139 memoizeProps(workInProgress, nextProps);140 return workInProgress.child;141 }142 function updateClassComponent(current, workInProgress, priorityLevel) {143 var hasContext = pushContextProvider(workInProgress);144 var shouldUpdate = void 0;145 if (current === null) {146 if (!workInProgress.stateNode) {147 constructClassInstance(workInProgress);148 mountClassInstance(workInProgress, priorityLevel);149 shouldUpdate = true;150 } else {151 shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel);152 }153 } else {154 shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel);155 }156 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);157 }158 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {159 markRef(current, workInProgress);160 if (!shouldUpdate) {161 return bailoutOnAlreadyFinishedWork(current, workInProgress);162 }163 var instance = workInProgress.stateNode;164 ReactCurrentOwner.current = workInProgress;165 var nextChildren = void 0;166 if (__DEV__) {167 ReactDebugCurrentFiber.phase = 'render';168 nextChildren = instance.render();169 ReactDebugCurrentFiber.phase = null;170 } else {171 nextChildren = instance.render();172 }173 reconcileChildren(current, workInProgress, nextChildren);174 memoizeState(workInProgress, instance.state);175 memoizeProps(workInProgress, instance.props);176 if (hasContext) {177 invalidateContextProvider(workInProgress);178 }179 return workInProgress.child;180 }181 function updateHostRoot(current, workInProgress, priorityLevel) {182 var root = workInProgress.stateNode;183 if (root.pendingContext) {184 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);185 } else if (root.context) {186 pushTopLevelContextObject(workInProgress, root.context, false);187 }188 pushHostContainer(workInProgress, root.containerInfo);189 var updateQueue = workInProgress.updateQueue;190 if (updateQueue !== null) {191 var prevState = workInProgress.memoizedState;192 var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);193 if (prevState === state) {194 return bailoutOnAlreadyFinishedWork(current, workInProgress);195 }196 var element = state.element;197 reconcileChildren(current, workInProgress, element);198 memoizeState(workInProgress, state);199 return workInProgress.child;200 }201 return bailoutOnAlreadyFinishedWork(current, workInProgress);202 }203 function updateHostComponent(current, workInProgress) {204 pushHostContext(workInProgress);205 var nextProps = workInProgress.pendingProps;206 var prevProps = current !== null ? current.memoizedProps : null;207 var memoizedProps = workInProgress.memoizedProps;208 if (hasContextChanged()) {209 if (nextProps === null) {210 nextProps = memoizedProps;211 invariant(nextProps !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');212 }213 } else if (nextProps === null || memoizedProps === nextProps) {214 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {215 var child = workInProgress.progressedChild;216 while (child !== null) {217 child.pendingWorkPriority = OffscreenPriority;218 child = child.sibling;219 }220 return null;221 }222 return bailoutOnAlreadyFinishedWork(current, workInProgress);223 }224 var nextChildren = nextProps.children;225 var isDirectTextChild = shouldSetTextContent(nextProps);226 if (isDirectTextChild) {227 nextChildren = null;228 } else if (prevProps && shouldSetTextContent(prevProps)) {229 workInProgress.effectTag |= ContentReset;230 }231 markRef(current, workInProgress);232 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {233 if (workInProgress.progressedPriority === OffscreenPriority) {234 workInProgress.child = workInProgress.progressedChild;235 }236 reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority);237 memoizeProps(workInProgress, nextProps);238 workInProgress.child = current !== null ? current.child : null;239 if (current === null) {240 var _child = workInProgress.progressedChild;241 while (_child !== null) {242 _child.effectTag = Placement;243 _child = _child.sibling;244 }245 }246 return null;247 } else {248 reconcileChildren(current, workInProgress, nextChildren);249 memoizeProps(workInProgress, nextProps);250 return workInProgress.child;251 }252 }253 function updateHostText(current, workInProgress) {254 var nextProps = workInProgress.pendingProps;255 if (nextProps === null) {256 nextProps = workInProgress.memoizedProps;257 }258 memoizeProps(workInProgress, nextProps);259 return null;260 }261 function mountIndeterminateComponent(current, workInProgress, priorityLevel) {262 invariant(current === null, 'An indeterminate component should never have mounted. This error is ' + 'likely caused by a bug in React. Please file an issue.');263 var fn = workInProgress.type;264 var props = workInProgress.pendingProps;265 var unmaskedContext = getUnmaskedContext(workInProgress);266 var context = getMaskedContext(workInProgress, unmaskedContext);267 var value;268 if (__DEV__) {269 ReactCurrentOwner.current = workInProgress;270 value = fn(props, context);271 } else {272 value = fn(props, context);273 }274 if (typeof value === 'object' && value !== null && typeof value.render === 'function') {275 workInProgress.tag = ClassComponent;276 var hasContext = pushContextProvider(workInProgress);277 adoptClassInstance(workInProgress, value);278 mountClassInstance(workInProgress, priorityLevel);279 return finishClassComponent(current, workInProgress, true, hasContext);280 } else {281 workInProgress.tag = FunctionalComponent;282 if (__DEV__) {283 var Component = workInProgress.type;284 if (Component) {285 warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');286 }287 if (workInProgress.ref !== null) {288 var info = '';289 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();290 if (ownerName) {291 info += '\n\nCheck the render method of `' + ownerName + '`.';292 }293 var warningKey = ownerName || workInProgress._debugID || '';294 var debugSource = workInProgress._debugSource;295 if (debugSource) {296 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;297 }298 if (!warnedAboutStatelessRefs[warningKey]) {299 warnedAboutStatelessRefs[warningKey] = true;300 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());301 }302 }303 }304 reconcileChildren(current, workInProgress, value);305 memoizeProps(workInProgress, props);306 return workInProgress.child;307 }308 }309 function updateCoroutineComponent(current, workInProgress) {310 var nextCoroutine = workInProgress.pendingProps;311 if (hasContextChanged()) {312 if (nextCoroutine === null) {313 nextCoroutine = current && current.memoizedProps;314 invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');315 }316 } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {317 nextCoroutine = workInProgress.memoizedProps;318 }319 var nextChildren = nextCoroutine.children;320 var priorityLevel = workInProgress.pendingWorkPriority;321 workInProgress.memoizedProps = null;322 if (current === null) {323 workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);324 } else if (current.child === workInProgress.child) {325 clearDeletions(workInProgress);326 workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);327 transferDeletions(workInProgress);328 } else {329 workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);330 transferDeletions(workInProgress);331 }332 memoizeProps(workInProgress, nextCoroutine);333 return workInProgress.stateNode;334 }335 function updatePortalComponent(current, workInProgress) {336 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);337 var priorityLevel = workInProgress.pendingWorkPriority;338 var nextChildren = workInProgress.pendingProps;339 if (hasContextChanged()) {340 if (nextChildren === null) {341 nextChildren = current && current.memoizedProps;342 invariant(nextChildren != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');343 }344 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {345 return bailoutOnAlreadyFinishedWork(current, workInProgress);346 }347 if (current === null) {348 workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);349 memoizeProps(workInProgress, nextChildren);350 markChildAsProgressed(current, workInProgress, priorityLevel);351 } else {352 reconcileChildren(current, workInProgress, nextChildren);353 memoizeProps(workInProgress, nextChildren);354 }355 return workInProgress.child;356 }357 function bailoutOnAlreadyFinishedWork(current, workInProgress) {358 if (__DEV__) {359 cancelWorkTimer(workInProgress);360 }361 var priorityLevel = workInProgress.pendingWorkPriority;362 if (current && workInProgress.child === current.child) {363 clearDeletions(workInProgress);364 }365 cloneChildFibers(current, workInProgress);366 markChildAsProgressed(current, workInProgress, priorityLevel);367 return workInProgress.child;368 }369 function bailoutOnLowPriority(current, workInProgress) {370 if (__DEV__) {371 cancelWorkTimer(workInProgress);372 }373 switch (workInProgress.tag) {374 case ClassComponent:375 pushContextProvider(workInProgress);376 break;377 case HostPortal:378 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);379 break;380 }381 return null;382 }383 function memoizeProps(workInProgress, nextProps) {384 workInProgress.memoizedProps = nextProps;385 workInProgress.pendingProps = null;386 }387 function memoizeState(workInProgress, nextState) {388 workInProgress.memoizedState = nextState;389 }...

Full Screen

Full Screen

f53fd5eb0f6d83330f45713d7ad4a8e61020b9ReactFiberBeginWork.js

Source:f53fd5eb0f6d83330f45713d7ad4a8e61020b9ReactFiberBeginWork.js Github

copy

Full Screen

...139 memoizeProps(workInProgress, nextProps);140 return workInProgress.child;141 }142 function updateClassComponent(current, workInProgress, priorityLevel) {143 var hasContext = pushContextProvider(workInProgress);144 var shouldUpdate = void 0;145 if (current === null) {146 if (!workInProgress.stateNode) {147 constructClassInstance(workInProgress);148 mountClassInstance(workInProgress, priorityLevel);149 shouldUpdate = true;150 } else {151 shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel);152 }153 } else {154 shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel);155 }156 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);157 }158 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {159 markRef(current, workInProgress);160 if (!shouldUpdate) {161 return bailoutOnAlreadyFinishedWork(current, workInProgress);162 }163 var instance = workInProgress.stateNode;164 ReactCurrentOwner.current = workInProgress;165 var nextChildren = void 0;166 if (__DEV__) {167 ReactDebugCurrentFiber.phase = 'render';168 nextChildren = instance.render();169 ReactDebugCurrentFiber.phase = null;170 } else {171 nextChildren = instance.render();172 }173 reconcileChildren(current, workInProgress, nextChildren);174 memoizeState(workInProgress, instance.state);175 memoizeProps(workInProgress, instance.props);176 if (hasContext) {177 invalidateContextProvider(workInProgress);178 }179 return workInProgress.child;180 }181 function updateHostRoot(current, workInProgress, priorityLevel) {182 var root = workInProgress.stateNode;183 if (root.pendingContext) {184 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);185 } else if (root.context) {186 pushTopLevelContextObject(workInProgress, root.context, false);187 }188 pushHostContainer(workInProgress, root.containerInfo);189 var updateQueue = workInProgress.updateQueue;190 if (updateQueue !== null) {191 var prevState = workInProgress.memoizedState;192 var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);193 if (prevState === state) {194 return bailoutOnAlreadyFinishedWork(current, workInProgress);195 }196 var element = state.element;197 reconcileChildren(current, workInProgress, element);198 memoizeState(workInProgress, state);199 return workInProgress.child;200 }201 return bailoutOnAlreadyFinishedWork(current, workInProgress);202 }203 function updateHostComponent(current, workInProgress) {204 pushHostContext(workInProgress);205 var nextProps = workInProgress.pendingProps;206 var prevProps = current !== null ? current.memoizedProps : null;207 var memoizedProps = workInProgress.memoizedProps;208 if (hasContextChanged()) {209 if (nextProps === null) {210 nextProps = memoizedProps;211 invariant(nextProps !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');212 }213 } else if (nextProps === null || memoizedProps === nextProps) {214 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {215 var child = workInProgress.progressedChild;216 while (child !== null) {217 child.pendingWorkPriority = OffscreenPriority;218 child = child.sibling;219 }220 return null;221 }222 return bailoutOnAlreadyFinishedWork(current, workInProgress);223 }224 var nextChildren = nextProps.children;225 var isDirectTextChild = shouldSetTextContent(nextProps);226 if (isDirectTextChild) {227 nextChildren = null;228 } else if (prevProps && shouldSetTextContent(prevProps)) {229 workInProgress.effectTag |= ContentReset;230 }231 markRef(current, workInProgress);232 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {233 if (workInProgress.progressedPriority === OffscreenPriority) {234 workInProgress.child = workInProgress.progressedChild;235 }236 reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority);237 memoizeProps(workInProgress, nextProps);238 workInProgress.child = current !== null ? current.child : null;239 if (current === null) {240 var _child = workInProgress.progressedChild;241 while (_child !== null) {242 _child.effectTag = Placement;243 _child = _child.sibling;244 }245 }246 return null;247 } else {248 reconcileChildren(current, workInProgress, nextChildren);249 memoizeProps(workInProgress, nextProps);250 return workInProgress.child;251 }252 }253 function updateHostText(current, workInProgress) {254 var nextProps = workInProgress.pendingProps;255 if (nextProps === null) {256 nextProps = workInProgress.memoizedProps;257 }258 memoizeProps(workInProgress, nextProps);259 return null;260 }261 function mountIndeterminateComponent(current, workInProgress, priorityLevel) {262 invariant(current === null, 'An indeterminate component should never have mounted. This error is ' + 'likely caused by a bug in React. Please file an issue.');263 var fn = workInProgress.type;264 var props = workInProgress.pendingProps;265 var unmaskedContext = getUnmaskedContext(workInProgress);266 var context = getMaskedContext(workInProgress, unmaskedContext);267 var value;268 if (__DEV__) {269 ReactCurrentOwner.current = workInProgress;270 value = fn(props, context);271 } else {272 value = fn(props, context);273 }274 if (typeof value === 'object' && value !== null && typeof value.render === 'function') {275 workInProgress.tag = ClassComponent;276 var hasContext = pushContextProvider(workInProgress);277 adoptClassInstance(workInProgress, value);278 mountClassInstance(workInProgress, priorityLevel);279 return finishClassComponent(current, workInProgress, true, hasContext);280 } else {281 workInProgress.tag = FunctionalComponent;282 if (__DEV__) {283 var Component = workInProgress.type;284 if (Component) {285 warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');286 }287 if (workInProgress.ref !== null) {288 var info = '';289 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();290 if (ownerName) {291 info += '\n\nCheck the render method of `' + ownerName + '`.';292 }293 var warningKey = ownerName || workInProgress._debugID || '';294 var debugSource = workInProgress._debugSource;295 if (debugSource) {296 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;297 }298 if (!warnedAboutStatelessRefs[warningKey]) {299 warnedAboutStatelessRefs[warningKey] = true;300 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());301 }302 }303 }304 reconcileChildren(current, workInProgress, value);305 memoizeProps(workInProgress, props);306 return workInProgress.child;307 }308 }309 function updateCoroutineComponent(current, workInProgress) {310 var nextCoroutine = workInProgress.pendingProps;311 if (hasContextChanged()) {312 if (nextCoroutine === null) {313 nextCoroutine = current && current.memoizedProps;314 invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');315 }316 } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {317 nextCoroutine = workInProgress.memoizedProps;318 }319 var nextChildren = nextCoroutine.children;320 var priorityLevel = workInProgress.pendingWorkPriority;321 workInProgress.memoizedProps = null;322 if (current === null) {323 workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);324 } else if (current.child === workInProgress.child) {325 clearDeletions(workInProgress);326 workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);327 transferDeletions(workInProgress);328 } else {329 workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);330 transferDeletions(workInProgress);331 }332 memoizeProps(workInProgress, nextCoroutine);333 return workInProgress.stateNode;334 }335 function updatePortalComponent(current, workInProgress) {336 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);337 var priorityLevel = workInProgress.pendingWorkPriority;338 var nextChildren = workInProgress.pendingProps;339 if (hasContextChanged()) {340 if (nextChildren === null) {341 nextChildren = current && current.memoizedProps;342 invariant(nextChildren != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');343 }344 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {345 return bailoutOnAlreadyFinishedWork(current, workInProgress);346 }347 if (current === null) {348 workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);349 memoizeProps(workInProgress, nextChildren);350 markChildAsProgressed(current, workInProgress, priorityLevel);351 } else {352 reconcileChildren(current, workInProgress, nextChildren);353 memoizeProps(workInProgress, nextChildren);354 }355 return workInProgress.child;356 }357 function bailoutOnAlreadyFinishedWork(current, workInProgress) {358 if (__DEV__) {359 cancelWorkTimer(workInProgress);360 }361 var priorityLevel = workInProgress.pendingWorkPriority;362 if (current && workInProgress.child === current.child) {363 clearDeletions(workInProgress);364 }365 cloneChildFibers(current, workInProgress);366 markChildAsProgressed(current, workInProgress, priorityLevel);367 return workInProgress.child;368 }369 function bailoutOnLowPriority(current, workInProgress) {370 if (__DEV__) {371 cancelWorkTimer(workInProgress);372 }373 switch (workInProgress.tag) {374 case ClassComponent:375 pushContextProvider(workInProgress);376 break;377 case HostPortal:378 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);379 break;380 }381 return null;382 }383 function memoizeProps(workInProgress, nextProps) {384 workInProgress.memoizedProps = nextProps;385 workInProgress.pendingProps = null;386 }387 function memoizeState(workInProgress, nextState) {388 workInProgress.memoizedState = nextState;389 }...

Full Screen

Full Screen

38fd25b340d9a8718c2ff51416edd6daa1ddf9ReactFiberBeginWork.js

Source:38fd25b340d9a8718c2ff51416edd6daa1ddf9ReactFiberBeginWork.js Github

copy

Full Screen

...139 memoizeProps(workInProgress, nextProps);140 return workInProgress.child;141 }142 function updateClassComponent(current, workInProgress, priorityLevel) {143 var hasContext = pushContextProvider(workInProgress);144 var shouldUpdate = void 0;145 if (current === null) {146 if (!workInProgress.stateNode) {147 constructClassInstance(workInProgress);148 mountClassInstance(workInProgress, priorityLevel);149 shouldUpdate = true;150 } else {151 shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel);152 }153 } else {154 shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel);155 }156 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext);157 }158 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext) {159 markRef(current, workInProgress);160 if (!shouldUpdate) {161 return bailoutOnAlreadyFinishedWork(current, workInProgress);162 }163 var instance = workInProgress.stateNode;164 ReactCurrentOwner.current = workInProgress;165 var nextChildren = void 0;166 if (__DEV__) {167 ReactDebugCurrentFiber.phase = 'render';168 nextChildren = instance.render();169 ReactDebugCurrentFiber.phase = null;170 } else {171 nextChildren = instance.render();172 }173 reconcileChildren(current, workInProgress, nextChildren);174 memoizeState(workInProgress, instance.state);175 memoizeProps(workInProgress, instance.props);176 if (hasContext) {177 invalidateContextProvider(workInProgress);178 }179 return workInProgress.child;180 }181 function updateHostRoot(current, workInProgress, priorityLevel) {182 var root = workInProgress.stateNode;183 if (root.pendingContext) {184 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);185 } else if (root.context) {186 pushTopLevelContextObject(workInProgress, root.context, false);187 }188 pushHostContainer(workInProgress, root.containerInfo);189 var updateQueue = workInProgress.updateQueue;190 if (updateQueue !== null) {191 var prevState = workInProgress.memoizedState;192 var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);193 if (prevState === state) {194 return bailoutOnAlreadyFinishedWork(current, workInProgress);195 }196 var element = state.element;197 reconcileChildren(current, workInProgress, element);198 memoizeState(workInProgress, state);199 return workInProgress.child;200 }201 return bailoutOnAlreadyFinishedWork(current, workInProgress);202 }203 function updateHostComponent(current, workInProgress) {204 pushHostContext(workInProgress);205 var nextProps = workInProgress.pendingProps;206 var prevProps = current !== null ? current.memoizedProps : null;207 var memoizedProps = workInProgress.memoizedProps;208 if (hasContextChanged()) {209 if (nextProps === null) {210 nextProps = memoizedProps;211 invariant(nextProps !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');212 }213 } else if (nextProps === null || memoizedProps === nextProps) {214 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {215 var child = workInProgress.progressedChild;216 while (child !== null) {217 child.pendingWorkPriority = OffscreenPriority;218 child = child.sibling;219 }220 return null;221 }222 return bailoutOnAlreadyFinishedWork(current, workInProgress);223 }224 var nextChildren = nextProps.children;225 var isDirectTextChild = shouldSetTextContent(nextProps);226 if (isDirectTextChild) {227 nextChildren = null;228 } else if (prevProps && shouldSetTextContent(prevProps)) {229 workInProgress.effectTag |= ContentReset;230 }231 markRef(current, workInProgress);232 if (!useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority) {233 if (workInProgress.progressedPriority === OffscreenPriority) {234 workInProgress.child = workInProgress.progressedChild;235 }236 reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority);237 memoizeProps(workInProgress, nextProps);238 workInProgress.child = current !== null ? current.child : null;239 if (current === null) {240 var _child = workInProgress.progressedChild;241 while (_child !== null) {242 _child.effectTag = Placement;243 _child = _child.sibling;244 }245 }246 return null;247 } else {248 reconcileChildren(current, workInProgress, nextChildren);249 memoizeProps(workInProgress, nextProps);250 return workInProgress.child;251 }252 }253 function updateHostText(current, workInProgress) {254 var nextProps = workInProgress.pendingProps;255 if (nextProps === null) {256 nextProps = workInProgress.memoizedProps;257 }258 memoizeProps(workInProgress, nextProps);259 return null;260 }261 function mountIndeterminateComponent(current, workInProgress, priorityLevel) {262 invariant(current === null, 'An indeterminate component should never have mounted. This error is ' + 'likely caused by a bug in React. Please file an issue.');263 var fn = workInProgress.type;264 var props = workInProgress.pendingProps;265 var unmaskedContext = getUnmaskedContext(workInProgress);266 var context = getMaskedContext(workInProgress, unmaskedContext);267 var value;268 if (__DEV__) {269 ReactCurrentOwner.current = workInProgress;270 value = fn(props, context);271 } else {272 value = fn(props, context);273 }274 if (typeof value === 'object' && value !== null && typeof value.render === 'function') {275 workInProgress.tag = ClassComponent;276 var hasContext = pushContextProvider(workInProgress);277 adoptClassInstance(workInProgress, value);278 mountClassInstance(workInProgress, priorityLevel);279 return finishClassComponent(current, workInProgress, true, hasContext);280 } else {281 workInProgress.tag = FunctionalComponent;282 if (__DEV__) {283 var Component = workInProgress.type;284 if (Component) {285 warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component');286 }287 if (workInProgress.ref !== null) {288 var info = '';289 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();290 if (ownerName) {291 info += '\n\nCheck the render method of `' + ownerName + '`.';292 }293 var warningKey = ownerName || workInProgress._debugID || '';294 var debugSource = workInProgress._debugSource;295 if (debugSource) {296 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;297 }298 if (!warnedAboutStatelessRefs[warningKey]) {299 warnedAboutStatelessRefs[warningKey] = true;300 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());301 }302 }303 }304 reconcileChildren(current, workInProgress, value);305 memoizeProps(workInProgress, props);306 return workInProgress.child;307 }308 }309 function updateCoroutineComponent(current, workInProgress) {310 var nextCoroutine = workInProgress.pendingProps;311 if (hasContextChanged()) {312 if (nextCoroutine === null) {313 nextCoroutine = current && current.memoizedProps;314 invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');315 }316 } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {317 nextCoroutine = workInProgress.memoizedProps;318 }319 var nextChildren = nextCoroutine.children;320 var priorityLevel = workInProgress.pendingWorkPriority;321 workInProgress.memoizedProps = null;322 if (current === null) {323 workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);324 } else if (current.child === workInProgress.child) {325 clearDeletions(workInProgress);326 workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);327 transferDeletions(workInProgress);328 } else {329 workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);330 transferDeletions(workInProgress);331 }332 memoizeProps(workInProgress, nextCoroutine);333 return workInProgress.stateNode;334 }335 function updatePortalComponent(current, workInProgress) {336 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);337 var priorityLevel = workInProgress.pendingWorkPriority;338 var nextChildren = workInProgress.pendingProps;339 if (hasContextChanged()) {340 if (nextChildren === null) {341 nextChildren = current && current.memoizedProps;342 invariant(nextChildren != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');343 }344 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {345 return bailoutOnAlreadyFinishedWork(current, workInProgress);346 }347 if (current === null) {348 workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);349 memoizeProps(workInProgress, nextChildren);350 markChildAsProgressed(current, workInProgress, priorityLevel);351 } else {352 reconcileChildren(current, workInProgress, nextChildren);353 memoizeProps(workInProgress, nextChildren);354 }355 return workInProgress.child;356 }357 function bailoutOnAlreadyFinishedWork(current, workInProgress) {358 if (__DEV__) {359 cancelWorkTimer(workInProgress);360 }361 var priorityLevel = workInProgress.pendingWorkPriority;362 if (current && workInProgress.child === current.child) {363 clearDeletions(workInProgress);364 }365 cloneChildFibers(current, workInProgress);366 markChildAsProgressed(current, workInProgress, priorityLevel);367 return workInProgress.child;368 }369 function bailoutOnLowPriority(current, workInProgress) {370 if (__DEV__) {371 cancelWorkTimer(workInProgress);372 }373 switch (workInProgress.tag) {374 case ClassComponent:375 pushContextProvider(workInProgress);376 break;377 case HostPortal:378 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);379 break;380 }381 return null;382 }383 function memoizeProps(workInProgress, nextProps) {384 workInProgress.memoizedProps = nextProps;385 workInProgress.pendingProps = null;386 }387 function memoizeState(workInProgress, nextState) {388 workInProgress.memoizedState = nextState;389 }...

Full Screen

Full Screen

ReactFiberContext.js

Source:ReactFiberContext.js Github

copy

Full Screen

1import { ClassComponent, HostRoot } from './ReactWorkTags';2import { createCursor, push, pop } from './ReactFiberStack';3const emptyContextObject = {};4const contextStackCursor = createCursor(emptyContextObject);5const didPerformWorkStackCursor = createCursor(false);6let previousContext = emptyContextObject;7const isContextProvider = (type) => {8 const { childContextTypes } = type;9 return childContextTypes !== null && childContextTypes !== undefined;10};11const popContext = (fiber) => {12 pop(didPerformWorkStackCursor, fiber);13 pop(contextStackCursor, fiber);14};15const findCurrentUnmaskedContext = (fiber) => {16 let node = fiber;17 do {18 switch (node.tag) {19 case HostRoot:20 return node.stateNode.context;21 case ClassComponent: {22 const Component = node.type;23 if (isContextProvider(Component)) {24 return node.stateNode.__reactInternalMemoizedMergedChildContext;25 }26 break;27 }28 }29 node = node.return;30 } while (node !== null);31};32const processChildContext = (fiber, type, parentContext) => {33 const instance = fiber.stateNode;34 if (typeof instance.getChildContext !== 'function') return parentContext;35 const childContext = instance.getChildContext();36 return { ...parentContext, ...childContext };37};38const hasContextChanged = () => didPerformWorkStackCursor.current;39const pushTopLevelContextObject = (fiber, context, didChange) => {40 push(contextStackCursor, context, fiber);41 push(didPerformWorkStackCursor, didChange, fiber);42};43const popTopLevelContextObject = (fiber) => {44 pop(didPerformWorkStackCursor, fiber);45 pop(contextStackCursor, fiber);46};47const pushContextProvider = (workInProgress) => {48 const instance = workInProgress.stateNode;49 const memoizedMergedChildContext =50 (instance && instance.__reactInternalMemoizedMergedChildContext) ||51 emptyContextObject;52 previousContext = contextStackCursor.current;53 push(contextStackCursor, memoizedMergedChildContext, workInProgress);54 push(55 didPerformWorkStackCursor,56 didPerformWorkStackCursor.current,57 workInProgress58 );59 return true;60};61const getUnmaskedContext = (62 workInProgress,63 Component,64 didPushOwnContextIfProvider65) => {66 if (didPushOwnContextIfProvider && isContextProvider(Component)) {67 return previousContext;68 }69 return contextStackCursor.current;70};71const cacheContext = (workInProgress, unmaskedContext, maskedContext) => {72 const instance = workInProgress.stateNode;73 instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;74 instance.__reactInternalMemoizedMaskedChildContext = maskedContext;75};76const getMaskedContext = (workInProgress, unmaskedContext) => {77 const type = workInProgress.type;78 const contextTypes = type.contextTypes;79 if (!contextTypes) return emptyContextObject;80 const instance = workInProgress.stateNode;81 if (82 instance &&83 instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext84 ) {85 return instance.__reactInternalMemoizedMaskedChildContext;86 }87 const context = {};88 for (const key in contextTypes) {89 context[key] = unmaskedContext[key];90 }91 if (instance) {92 cacheContext(workInProgress, unmaskedContext, context);93 }94 return context;95};96const invalidateContextProvider = (workInProgress, type, didChange) => {97 const instance = workInProgress.stateNode;98 invariant(99 instance,100 'Expected to have an instance by this point. ' +101 'This error is likely caused by a bug in React. Please file an issue.'102 );103 if (didChange) {104 const mergedContext = processChildContext(105 workInProgress,106 type,107 previousContext108 );109 instance.__reactInternalMemoizedMergedChildContext = mergedContext;110 pop(didPerformWorkStackCursor, workInProgress);111 pop(contextStackCursor, workInProgress);112 push(contextStackCursor, mergedContext, workInProgress);113 push(didPerformWorkStackCursor, didChange, workInProgress);114 } else {115 pop(didPerformWorkStackCursor, workInProgress);116 push(didPerformWorkStackCursor, didChange, workInProgress);117 }118};119export {120 emptyContextObject,121 isContextProvider,122 popContext,123 findCurrentUnmaskedContext,124 processChildContext,125 hasContextChanged,126 pushTopLevelContextObject,127 popTopLevelContextObject,128 pushContextProvider,129 getUnmaskedContext,130 getMaskedContext,131 cacheContext,132 invalidateContextProvider,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await context.close();7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await context.close();15 await browser.close();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await context.close();23 await browser.close();24})();25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await context.close();31 await browser.close();32})();33const { chromium } = require('playwright');34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await context.close();39 await browser.close();40})();41const { chromium } = require('playwright');42(async () => {43 const browser = await chromium.launch();44 const context = await browser.newContext();45 const page = await context.newPage();46 await context.close();47 await browser.close();48})();49const { chromium } = require('playwright');50(async () => {51 const browser = await chromium.launch();52 const context = await browser.newContext();53 const page = await context.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright-chromium');2const path = require('path');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const elementHandle = await page.$('input[name="q"]');8 await elementHandle.press('Enter');9 await page.screenshot({ path: path.join(__dirname, 'google.png') });10 await browser.close();11})();12const {chromium} = require('playwright-chromium');13const path = require('path');14(async () => {15 const browser = await chromium.launch();16 const context = await browser.newContext();17 const page = await context.newPage();18 const elementHandle = await page.$('input[name="q"]');19 await elementHandle.press('Enter');20 await page.screenshot({ path: path.join(__dirname, 'google.png') });21 await browser.close();22})();23const {chromium} = require('playwright-chromium');24const path = require('path');25(async () => {26 const browser = await chromium.launch();27 const context = await browser.newContext();28 const page = await context.newPage();29 const elementHandle = await page.$('input[name="q"]');30 await elementHandle.press('Enter');31 await page.screenshot({ path: path.join(__dirname, 'google.png') });32 await browser.close();33})();34const {chromium} = require('playwright-chromium');35const path = require('path');36(async () => {37 const browser = await chromium.launch();38 const context = await browser.newContext();39 const page = await context.newPage();40 const elementHandle = await page.$('input[name="q"]');41 await elementHandle.press('Enter');42 await page.screenshot({ path: path.join(__dirname, 'google.png') });43 await browser.close();44})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 await context.pushContextProvider({6 route: (route, request) => {7 if (request.url().includes('test.html')) {8 route.fulfill({9 });10 } else {11 route.continue();12 }13 },14 });15 const page = await context.newPage();16 await page.goto('test.html');17 await page.screenshot({ path: 'test.png' });18 await browser.close();19})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { pushContextProvider } = require('playwright-core/lib/server/browserContext');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await browser.close();8})();9import { BrowserContext, BrowserContextOptions } from './browserContext';10import { Page } from './page';11import { assert } from '../utils/utils';12import { Events } from './events';13import { Protocol } from 'devtools-protocol';14import { BrowserContextChannel, BrowserContextInitializer } from '../channels';15import { Browser } from './browser';16import { BrowserServer } from './browserServer';17import { ViewportSize } from './types';18import { TimeoutSettings } from '../utils/timeoutSettings';19import { PageProxy } from './pageProxy';20import { CRBrowser } from './chromium/crBrowser';21import { CRBrowserContext } from './chromium/crBrowserContext';22import { CRPage } from './chromium/crPage';23import { WKBrowser } from './webkit/wkBrowser';24import { WKBrowserContext } from './webkit/wkBrowserContext';25import { WKPage } from './webkit/wkPage';26import { FFPage } from './firefox/ffPage';27import { FFBrowserContext } from './firefox/ffBrowserContext';28import { FFBrowser } from './firefox/ffBrowser';29import { PageEvent } from './pageEvents';30import { ViewportSize } from './types';31import { assert } from '../utils/utils';32import { TimeoutSettings } from '../utils/timeoutSettings';33import { PageProxy } from './pageProxy';34import { PageEvent } from './pageEvents';35import { ViewportSize } from './types';36import { assert } from '../utils/utils';37import { TimeoutSettings } from '../utils/timeoutSettings';38import { PageProxy } from './pageProxy';39import { PageEvent } from './pageEvents';40import { ViewportSize } from './types';41import { assert } from '../utils/utils';42import { TimeoutSettings } from '../utils/timeoutSettings';43import { PageProxy } from './pageProxy';44import { PageEvent } from './pageEvents';45import { Viewport

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { PushContextProvider } = require('playwright/lib/server/pushContextProvider');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const pushContextProvider = new PushContextProvider(page);8 const pushContext = await pushContextProvider.pushContext();9 const pushPage = await pushContext.newPage();10 await pushPage.close();11 await context.close();12})();13const { chromium } = require('playwright');14const { PushContextProvider } = require('playwright/lib/server/pushContextProvider');15(async () => {16 const browser = await chromium.launch();17 const context = await browser.newContext();18 const page = await context.newPage();19 const pushContextProvider = new PushContextProvider(page);20 const pushContext = await pushContextProvider.pushContext();21 const pushPage = await pushContext.newPage();22 await pushPage.close();23 await context.close();24})();25const { chromium } = require('playwright');26const { PushContextProvider } = require('playwright/lib/server/pushContextProvider');27(async () => {28 const browser = await chromium.launch();29 const context = await browser.newContext();30 const page = await context.newPage();31 const pushContextProvider = new PushContextProvider(page);32 const pushContext = await pushContextProvider.pushContext();33 const pushPage = await pushContext.newPage();34 await pushPage.close();35 await context.close();36})();37const { chromium } = require('playwright');38const { PushContextProvider } = require('playwright/lib/server/pushContextProvider');39(async () => {40 const browser = await chromium.launch();41 const context = await browser.newContext();42 const page = await context.newPage();43 const pushContextProvider = new PushContextProvider(page);44 const pushContext = await pushContextProvider.pushContext();45 const pushPage = await pushContext.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { PlaywrightInternalContext } = require('playwright/lib/server/chromium/crBrowser');2const { PlaywrightInternalPage } = require('playwright/lib/server/chromium/crPage');3const { PlaywrightInternalRequest } = require('playwright/lib/server/chromium/crNetworkManager');4const { PlaywrightInternalResponse } = require('playwright/lib/server/chromium/crNetworkManager');5class MyCustomRequest extends PlaywrightInternalRequest {6 constructor(page, event) {7 super(page, event);8 this._headers = event.headers;9 }10}11class MyCustomResponse extends PlaywrightInternalResponse {12 constructor(page, event) {13 super(page, event);14 this._headers = event.headers;15 }16}17class MyCustomPage extends PlaywrightInternalPage {18 constructor(browserContext, pageOrError) {19 super(browserContext, pageOrError);20 }21 _createRequest(event) {22 return new MyCustomRequest(this, event);23 }24 _createResponse(event) {25 return new MyCustomResponse(this, event);26 }27}28class MyCustomContext extends PlaywrightInternalContext {29 constructor(browser, contextId) {30 super(browser, contextId);31 }32 _createPage(pageOrError) {33 return new MyCustomPage(this, pageOrError);34 }35}36module.exports = {37};38const { PlaywrightInternalContext } = require('./customContext.js');39const { chromium } = require('playwright');40(async () => {41 const browser = await chromium.launch();42 const context = await browser.newContext();43 const page = await context.newPage();44})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { pushContextProvider } = require('playwright/lib/client/initializer');3const { BrowserContext } = require('playwright/lib/client/browserContext');4const { Page } = require('playwright/lib/client/page');5pushContextProvider(async (client, context) => {6 if (context instanceof BrowserContext) {7 return new MyContext(client, context);8 }9 if (context instanceof Page) {10 return new MyPage(client, context);11 }12});13class MyContext {14 constructor(client, context) {15 this._client = client;16 this._context = context;17 }18 async newPage() {19 return new MyPage(this._client, await this._context.newPage());20 }21}22class MyPage {23 constructor(client, page) {24 this._client = client;25 this._page = page;26 }27 async goto(url) {28 await this._page.goto(url);29 }30 async click(selector) {31 await this._page.click(selector);32 }33}34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.click('text=Get started');39 await browser.close();40})();41const { test, expect } = require('@playwright/test');42test('My test', async ({ page }) => {43 await page.click('text=Get started');44});45const { chromium } = require('playwright');46const { pushContextProvider } = require('playwright/lib/client/initializer');47const { BrowserContext } = require('playwright/lib/client

Full Screen

Using AI Code Generation

copy

Full Screen

1const { _electron } = require('playwright');2const { contextBridge } = require('electron');3const { ipcRenderer } = require('electron');4contextBridge.exposeInMainWorld("playwright", {5});6contextBridge.exposeInMainWorld("electron", {7});8const { contextBridge } = require('electron');9const { ipcRenderer } = require('electron');10contextBridge.exposeInMainWorld("electron", {11});12const playwright = require('playwright');13const { ipcRenderer } = require('electron');14(async () => {15 const browser = await playwright['chromium'].launch({16 executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'17 });18 const context = await browser.newContext();19 const page = await context.newPage();20 await page.screenshot({ path: 'example.png' });21 await browser.close();22})();23const { ipcRenderer } = require('electron');24const playwright = require('playwright');25const { BrowserContext } = require('playwright');26ipcRenderer.on('playwright', async (event, arg) => {27 const { browserType, launchOptions, contextOptions, pageOptions } = arg;28 const browser = await playwright[browserType].launch(launchOptions);29 const context = await browser.newContext(contextOptions);30 const page = await context.newPage(pageOptions);31 await page.screenshot({ path: 'example.png' });32 await browser.close();33});34const { app, BrowserWindow } = require('electron');35const path = require('path');36function createWindow() {37 const mainWindow = new BrowserWindow({38 webPreferences: {39 preload: path.join(__dirname, 'preload.js')40 }41 });42 mainWindow.loadFile('index.html');43}44app.whenReady().then(() => {45 createWindow();46 app.on('activate', function () {47 if (Browser

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful