How to use hasContextChanged method in Playwright Internal

Best JavaScript code snippet using playwright-internal

b0ea876b301f63c96d702a493f5ebd456144bcReactFiberBeginWork.js

Source:b0ea876b301f63c96d702a493f5ebd456144bcReactFiberBeginWork.js Github

copy

Full Screen

...89 markChildAsProgressed(current, workInProgress, priorityLevel);90 }91 function updateFragment(current, workInProgress) {92 var nextChildren = workInProgress.pendingProps;93 if (hasContextChanged()) {94 if (nextChildren === null) {95 nextChildren = workInProgress.memoizedProps;96 }97 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {98 return bailoutOnAlreadyFinishedWork(current, workInProgress);99 }100 reconcileChildren(current, workInProgress, nextChildren);101 memoizeProps(workInProgress, nextChildren);102 return workInProgress.child;103 }104 function markRef(current, workInProgress) {105 var ref = workInProgress.ref;106 if (ref !== null && (!current || current.ref !== ref)) {107 workInProgress.effectTag |= Ref;108 }109 }110 function updateFunctionalComponent(current, workInProgress) {111 var fn = workInProgress.type;112 var nextProps = workInProgress.pendingProps;113 var memoizedProps = workInProgress.memoizedProps;114 if (hasContextChanged()) {115 if (nextProps === null) {116 nextProps = memoizedProps;117 }118 } else {119 if (nextProps === null || memoizedProps === nextProps) {120 return bailoutOnAlreadyFinishedWork(current, workInProgress);121 }122 if (typeof fn.shouldComponentUpdate === 'function' && !fn.shouldComponentUpdate(memoizedProps, nextProps)) {123 memoizeProps(workInProgress, nextProps);124 return bailoutOnAlreadyFinishedWork(current, workInProgress);125 }126 }127 var unmaskedContext = getUnmaskedContext(workInProgress);128 var context = getMaskedContext(workInProgress, unmaskedContext);129 var nextChildren;130 if (__DEV__) {131 ReactCurrentOwner.current = workInProgress;132 ReactDebugCurrentFiber.phase = 'render';133 nextChildren = fn(nextProps, context);134 ReactDebugCurrentFiber.phase = null;135 } else {136 nextChildren = fn(nextProps, context);137 }138 reconcileChildren(current, workInProgress, nextChildren);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);...

Full Screen

Full Screen

0c0973fc7971824d7f8a174e5eae9c482a6244ReactFiberBeginWork.js

Source:0c0973fc7971824d7f8a174e5eae9c482a6244ReactFiberBeginWork.js Github

copy

Full Screen

...89 markChildAsProgressed(current, workInProgress, priorityLevel);90 }91 function updateFragment(current, workInProgress) {92 var nextChildren = workInProgress.pendingProps;93 if (hasContextChanged()) {94 if (nextChildren === null) {95 nextChildren = workInProgress.memoizedProps;96 }97 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {98 return bailoutOnAlreadyFinishedWork(current, workInProgress);99 }100 reconcileChildren(current, workInProgress, nextChildren);101 memoizeProps(workInProgress, nextChildren);102 return workInProgress.child;103 }104 function markRef(current, workInProgress) {105 var ref = workInProgress.ref;106 if (ref !== null && (!current || current.ref !== ref)) {107 workInProgress.effectTag |= Ref;108 }109 }110 function updateFunctionalComponent(current, workInProgress) {111 var fn = workInProgress.type;112 var nextProps = workInProgress.pendingProps;113 var memoizedProps = workInProgress.memoizedProps;114 if (hasContextChanged()) {115 if (nextProps === null) {116 nextProps = memoizedProps;117 }118 } else {119 if (nextProps === null || memoizedProps === nextProps) {120 return bailoutOnAlreadyFinishedWork(current, workInProgress);121 }122 if (typeof fn.shouldComponentUpdate === 'function' && !fn.shouldComponentUpdate(memoizedProps, nextProps)) {123 memoizeProps(workInProgress, nextProps);124 return bailoutOnAlreadyFinishedWork(current, workInProgress);125 }126 }127 var unmaskedContext = getUnmaskedContext(workInProgress);128 var context = getMaskedContext(workInProgress, unmaskedContext);129 var nextChildren;130 if (__DEV__) {131 ReactCurrentOwner.current = workInProgress;132 ReactDebugCurrentFiber.phase = 'render';133 nextChildren = fn(nextProps, context);134 ReactDebugCurrentFiber.phase = null;135 } else {136 nextChildren = fn(nextProps, context);137 }138 reconcileChildren(current, workInProgress, nextChildren);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);...

Full Screen

Full Screen

a9c9772a1f3ee8b9618c4d3bc7e33597822442ReactFiberBeginWork.js

Source:a9c9772a1f3ee8b9618c4d3bc7e33597822442ReactFiberBeginWork.js Github

copy

Full Screen

...89 markChildAsProgressed(current, workInProgress, priorityLevel);90 }91 function updateFragment(current, workInProgress) {92 var nextChildren = workInProgress.pendingProps;93 if (hasContextChanged()) {94 if (nextChildren === null) {95 nextChildren = workInProgress.memoizedProps;96 }97 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {98 return bailoutOnAlreadyFinishedWork(current, workInProgress);99 }100 reconcileChildren(current, workInProgress, nextChildren);101 memoizeProps(workInProgress, nextChildren);102 return workInProgress.child;103 }104 function markRef(current, workInProgress) {105 var ref = workInProgress.ref;106 if (ref !== null && (!current || current.ref !== ref)) {107 workInProgress.effectTag |= Ref;108 }109 }110 function updateFunctionalComponent(current, workInProgress) {111 var fn = workInProgress.type;112 var nextProps = workInProgress.pendingProps;113 var memoizedProps = workInProgress.memoizedProps;114 if (hasContextChanged()) {115 if (nextProps === null) {116 nextProps = memoizedProps;117 }118 } else {119 if (nextProps === null || memoizedProps === nextProps) {120 return bailoutOnAlreadyFinishedWork(current, workInProgress);121 }122 if (typeof fn.shouldComponentUpdate === 'function' && !fn.shouldComponentUpdate(memoizedProps, nextProps)) {123 memoizeProps(workInProgress, nextProps);124 return bailoutOnAlreadyFinishedWork(current, workInProgress);125 }126 }127 var unmaskedContext = getUnmaskedContext(workInProgress);128 var context = getMaskedContext(workInProgress, unmaskedContext);129 var nextChildren;130 if (__DEV__) {131 ReactCurrentOwner.current = workInProgress;132 ReactDebugCurrentFiber.phase = 'render';133 nextChildren = fn(nextProps, context);134 ReactDebugCurrentFiber.phase = null;135 } else {136 nextChildren = fn(nextProps, context);137 }138 reconcileChildren(current, workInProgress, nextChildren);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);...

Full Screen

Full Screen

5ecaac3714568df47d1bdc3115b642621abd87ReactFiberBeginWork.js

Source:5ecaac3714568df47d1bdc3115b642621abd87ReactFiberBeginWork.js Github

copy

Full Screen

...89 markChildAsProgressed(current, workInProgress, priorityLevel);90 }91 function updateFragment(current, workInProgress) {92 var nextChildren = workInProgress.pendingProps;93 if (hasContextChanged()) {94 if (nextChildren === null) {95 nextChildren = workInProgress.memoizedProps;96 }97 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {98 return bailoutOnAlreadyFinishedWork(current, workInProgress);99 }100 reconcileChildren(current, workInProgress, nextChildren);101 memoizeProps(workInProgress, nextChildren);102 return workInProgress.child;103 }104 function markRef(current, workInProgress) {105 var ref = workInProgress.ref;106 if (ref !== null && (!current || current.ref !== ref)) {107 workInProgress.effectTag |= Ref;108 }109 }110 function updateFunctionalComponent(current, workInProgress) {111 var fn = workInProgress.type;112 var nextProps = workInProgress.pendingProps;113 var memoizedProps = workInProgress.memoizedProps;114 if (hasContextChanged()) {115 if (nextProps === null) {116 nextProps = memoizedProps;117 }118 } else {119 if (nextProps === null || memoizedProps === nextProps) {120 return bailoutOnAlreadyFinishedWork(current, workInProgress);121 }122 if (typeof fn.shouldComponentUpdate === 'function' && !fn.shouldComponentUpdate(memoizedProps, nextProps)) {123 memoizeProps(workInProgress, nextProps);124 return bailoutOnAlreadyFinishedWork(current, workInProgress);125 }126 }127 var unmaskedContext = getUnmaskedContext(workInProgress);128 var context = getMaskedContext(workInProgress, unmaskedContext);129 var nextChildren;130 if (__DEV__) {131 ReactCurrentOwner.current = workInProgress;132 ReactDebugCurrentFiber.phase = 'render';133 nextChildren = fn(nextProps, context);134 ReactDebugCurrentFiber.phase = null;135 } else {136 nextChildren = fn(nextProps, context);137 }138 reconcileChildren(current, workInProgress, nextChildren);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);...

Full Screen

Full Screen

8a2b1d695be0826d1657ee10d51695117eb487ReactFiberBeginWork.js

Source:8a2b1d695be0826d1657ee10d51695117eb487ReactFiberBeginWork.js Github

copy

Full Screen

...89 markChildAsProgressed(current, workInProgress, priorityLevel);90 }91 function updateFragment(current, workInProgress) {92 var nextChildren = workInProgress.pendingProps;93 if (hasContextChanged()) {94 if (nextChildren === null) {95 nextChildren = workInProgress.memoizedProps;96 }97 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {98 return bailoutOnAlreadyFinishedWork(current, workInProgress);99 }100 reconcileChildren(current, workInProgress, nextChildren);101 memoizeProps(workInProgress, nextChildren);102 return workInProgress.child;103 }104 function markRef(current, workInProgress) {105 var ref = workInProgress.ref;106 if (ref !== null && (!current || current.ref !== ref)) {107 workInProgress.effectTag |= Ref;108 }109 }110 function updateFunctionalComponent(current, workInProgress) {111 var fn = workInProgress.type;112 var nextProps = workInProgress.pendingProps;113 var memoizedProps = workInProgress.memoizedProps;114 if (hasContextChanged()) {115 if (nextProps === null) {116 nextProps = memoizedProps;117 }118 } else {119 if (nextProps === null || memoizedProps === nextProps) {120 return bailoutOnAlreadyFinishedWork(current, workInProgress);121 }122 if (typeof fn.shouldComponentUpdate === 'function' && !fn.shouldComponentUpdate(memoizedProps, nextProps)) {123 memoizeProps(workInProgress, nextProps);124 return bailoutOnAlreadyFinishedWork(current, workInProgress);125 }126 }127 var unmaskedContext = getUnmaskedContext(workInProgress);128 var context = getMaskedContext(workInProgress, unmaskedContext);129 var nextChildren;130 if (__DEV__) {131 ReactCurrentOwner.current = workInProgress;132 ReactDebugCurrentFiber.phase = 'render';133 nextChildren = fn(nextProps, context);134 ReactDebugCurrentFiber.phase = null;135 } else {136 nextChildren = fn(nextProps, context);137 }138 reconcileChildren(current, workInProgress, nextChildren);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);...

Full Screen

Full Screen

34599645ab8f136bb4f4fe68a8ebd038aab6aaReactFiberBeginWork.js

Source:34599645ab8f136bb4f4fe68a8ebd038aab6aaReactFiberBeginWork.js Github

copy

Full Screen

...89 markChildAsProgressed(current, workInProgress, priorityLevel);90 }91 function updateFragment(current, workInProgress) {92 var nextChildren = workInProgress.pendingProps;93 if (hasContextChanged()) {94 if (nextChildren === null) {95 nextChildren = workInProgress.memoizedProps;96 }97 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {98 return bailoutOnAlreadyFinishedWork(current, workInProgress);99 }100 reconcileChildren(current, workInProgress, nextChildren);101 memoizeProps(workInProgress, nextChildren);102 return workInProgress.child;103 }104 function markRef(current, workInProgress) {105 var ref = workInProgress.ref;106 if (ref !== null && (!current || current.ref !== ref)) {107 workInProgress.effectTag |= Ref;108 }109 }110 function updateFunctionalComponent(current, workInProgress) {111 var fn = workInProgress.type;112 var nextProps = workInProgress.pendingProps;113 var memoizedProps = workInProgress.memoizedProps;114 if (hasContextChanged()) {115 if (nextProps === null) {116 nextProps = memoizedProps;117 }118 } else {119 if (nextProps === null || memoizedProps === nextProps) {120 return bailoutOnAlreadyFinishedWork(current, workInProgress);121 }122 if (typeof fn.shouldComponentUpdate === 'function' && !fn.shouldComponentUpdate(memoizedProps, nextProps)) {123 memoizeProps(workInProgress, nextProps);124 return bailoutOnAlreadyFinishedWork(current, workInProgress);125 }126 }127 var unmaskedContext = getUnmaskedContext(workInProgress);128 var context = getMaskedContext(workInProgress, unmaskedContext);129 var nextChildren;130 if (__DEV__) {131 ReactCurrentOwner.current = workInProgress;132 ReactDebugCurrentFiber.phase = 'render';133 nextChildren = fn(nextProps, context);134 ReactDebugCurrentFiber.phase = null;135 } else {136 nextChildren = fn(nextProps, context);137 }138 reconcileChildren(current, workInProgress, nextChildren);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);...

Full Screen

Full Screen

28635758b81a7e604b1671f3557aaaf2fcce39ReactFiberBeginWork.js

Source:28635758b81a7e604b1671f3557aaaf2fcce39ReactFiberBeginWork.js Github

copy

Full Screen

...89 markChildAsProgressed(current, workInProgress, priorityLevel);90 }91 function updateFragment(current, workInProgress) {92 var nextChildren = workInProgress.pendingProps;93 if (hasContextChanged()) {94 if (nextChildren === null) {95 nextChildren = workInProgress.memoizedProps;96 }97 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {98 return bailoutOnAlreadyFinishedWork(current, workInProgress);99 }100 reconcileChildren(current, workInProgress, nextChildren);101 memoizeProps(workInProgress, nextChildren);102 return workInProgress.child;103 }104 function markRef(current, workInProgress) {105 var ref = workInProgress.ref;106 if (ref !== null && (!current || current.ref !== ref)) {107 workInProgress.effectTag |= Ref;108 }109 }110 function updateFunctionalComponent(current, workInProgress) {111 var fn = workInProgress.type;112 var nextProps = workInProgress.pendingProps;113 var memoizedProps = workInProgress.memoizedProps;114 if (hasContextChanged()) {115 if (nextProps === null) {116 nextProps = memoizedProps;117 }118 } else {119 if (nextProps === null || memoizedProps === nextProps) {120 return bailoutOnAlreadyFinishedWork(current, workInProgress);121 }122 if (typeof fn.shouldComponentUpdate === 'function' && !fn.shouldComponentUpdate(memoizedProps, nextProps)) {123 memoizeProps(workInProgress, nextProps);124 return bailoutOnAlreadyFinishedWork(current, workInProgress);125 }126 }127 var unmaskedContext = getUnmaskedContext(workInProgress);128 var context = getMaskedContext(workInProgress, unmaskedContext);129 var nextChildren;130 if (__DEV__) {131 ReactCurrentOwner.current = workInProgress;132 ReactDebugCurrentFiber.phase = 'render';133 nextChildren = fn(nextProps, context);134 ReactDebugCurrentFiber.phase = null;135 } else {136 nextChildren = fn(nextProps, context);137 }138 reconcileChildren(current, workInProgress, nextChildren);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);...

Full Screen

Full Screen

async.test.js

Source:async.test.js Github

copy

Full Screen

...23 expect(result).toEqual(true);24 });25 it('getters: `hasContextChanged`', () => {26 const state = { contextChanged: true };27 const result = getters.hasContextChanged(state);28 expect(result).toEqual(true);29 });...

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 page.click('text=Get started');7 await page.waitForNavigation();8 console.log(await context._hasContextChanged());9 await browser.close();10})();11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const context = await browser.newContext();15 const page = await context.newPage();16 await page.click('text=Get started');17 await page.waitForNavigation();18 console.log(await context._hasContextChanged());19 await browser.close();20})();21Playwright Internal API: hasContextChanged() method22context._hasContextChanged()23const { chromium } = require('playwright');24(async () => {25 const browser = await chromium.launch();26 const context = await browser.newContext();27 const page = await context.newPage();28 await page.click('text=Get started');29 await page.waitForNavigation();30 console.log(await context._hasContextChanged());31 await browser.close();32})();33Playwright Internal API: hasContextChanged() method34context._hasContextChanged()35const { chromium } = require('playwright');36(async () => {37 const browser = await chromium.launch();38 const context = await browser.newContext();39 const page = await context.newPage();40 await page.click('text=Get started');41 await page.waitForNavigation();42 console.log(await context._hasContextChanged());

Full Screen

Using AI Code Generation

copy

Full Screen

1const context = await browser.newContext();2await context.addCookies([{ name: 'cookie1', value: 'value1' }]);3await context.addCookies([{ name: 'cookie2', value: 'value2' }]);4const hasContextChanged = context._hasContextChanged();5console.log(hasContextChanged);6const context = await browser.newContext();7await context.addCookies([{ name: 'cookie1', value: 'value1' }]);8await context.addCookies([{ name: 'cookie2', value: 'value2' }]);9const storageState = await context.storageState();10console.log(storageState);11{12 {13 },14 {15 }16}17const context = await browser.newContext();18await context.addCookies([{ name: 'cookie1', value: 'value1' }]);19await context.addCookies([{ name: 'cookie2', value: 'value2' }]);20await context.clearCookies();21const storageState = await context.storageState();22console.log(storageState);23{24}25const context = await browser.newContext();

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 console.log(await context._delegate.hasContextChanged());7 console.log(await context._delegate.hasContextChanged());8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const context = await chromium.launchPersistentContext('C:\\Users\\username\\AppData\\Local\\Google\\Chrome\\User Data', {4 });5 const page = await context.newPage();6 await page.screenshot({ path: 'google.png' });7 const hasContextChanged = await context._browser._hasContextChanged(context);8 console.log(hasContextChanged);9 await context.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { hasContextChanged } = require('@playwright/test/lib/test');2const { test } = require('@playwright/test');3test('test', async ({ page }) => {4 await hasContextChanged(page.context());5});6 at Object.test (test.js:6:46)7 at WorkerRunner._runTestWithBeforeHooks (C:\Users\user\AppData\Roaming8 at WorkerRunner._runTest (C:\Users\user\AppData\Roaming9 at WorkerRunner._runTest (C:\Users\user\AppData\Roaming10 at WorkerRunner._runTest (C:\Users\user\AppData\Roaming11 at WorkerRunner._runTest (C:\Users\user\AppData\Roaming12 at WorkerRunner._runTest (C:\Users\user\AppData\Roaming13 at Object.runNextTicks [as _onImmediate] (internal/process/task_queues.js:56:5)14 at processImmediate (internal/timers.js:461:21)15const { hasContextChanged } = require('@playwright/test/lib/test');16const { test } = require('@playwright/test');17test('test', async ({ page }) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { hasContextChanged } = require('playwright-core/lib/server/browserContext');2const context = page.context();3const originalContext = context._browser._contexts[0];4const { hasContextChanged } = require('playwright-core/lib/server/browserContext');5const context = page.context();6const originalContext = context._browser._contexts[0];7const { hasContextChanged } = require('playwright-core/lib/server/browserContext');8const context = page.context();9const originalContext = context._browser._contexts[0];10const { hasContextChanged } = require('playwright-core/lib/server/browserContext');11const context = page.context();12const originalContext = context._browser._contexts[0];13const { hasContextChanged } = require('playwright-core/lib/server/browserContext');14const context = page.context();15const originalContext = context._browser._contexts[0];16const { hasContextChanged } = require('playwright-core/lib/server/browserContext');17const context = page.context();18const originalContext = context._browser._contexts[0];19const { hasContextChanged } = require('playwright-core/lib/server/browserContext');20const context = page.context();21const originalContext = context._browser._contexts[0];22const { hasContextChanged } = require('playwright-core/lib/server/browserContext');23const context = page.context();24const originalContext = context._browser._contexts[0];25const { hasContextChanged } = require('playwright-core/lib/server/browserContext');26const context = page.context();27const originalContext = context._browser._contexts[0];28const { hasContextChanged } = require('playwright-core/lib/server/browserContext');29const context = page.context();30const originalContext = context._browser._contexts[0];31console.log(hasContextChanged(originalContext

Full Screen

Using AI Code Generation

copy

Full Screen

1const {hasContextChanged} = require('playwright-core/lib/server/browserContext');2const {hasContextChanged} = require('playwright-core/lib/server/browserContext');3const context = await browser.newContext();4const page = await context.newPage();5const oldContextId = context._id;6const isContextChanged = hasContextChanged(context, oldContextId);7console.log(isContextChanged);8const {hasContextChanged} = require('playwright-core/lib/server/browserContext');9const context = await browser.newContext();10const page = await context.newPage();11const oldContextId = context._id;12const isContextChanged = hasContextChanged(context, oldContextId);13console.log(isContextChanged);14const {hasContextChanged} = require('playwright-core/lib/server/browserContext');15const context = await browser.newContext();16const page = await context.newPage();17const oldContextId = context._id;18const isContextChanged = hasContextChanged(context, oldContextId);19console.log(isContextChanged);

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