MCPcopy Create free account
hub / github.com/BetaSu/big-react / commitPassiveEffect

Function commitPassiveEffect

packages/react-reconciler/src/commitWork.ts:278–297  ·  view source on GitHub ↗
(
	fiber: FiberNode,
	root: FiberRootNode,
	type: keyof PendingPassiveEffects
)

Source from the content-addressed store, hash-verified

276}
277
278function commitPassiveEffect(
279 fiber: FiberNode,
280 root: FiberRootNode,
281 type: keyof PendingPassiveEffects
282) {
283 // update unmount
284 if (
285 fiber.tag !== FunctionComponent ||
286 (type === 'update' && (fiber.flags & PassiveEffect) === NoFlags)
287 ) {
288 return;
289 }
290 const updateQueue = fiber.updateQueue as FCUpdateQueue<any>;
291 if (updateQueue !== null) {
292 if (updateQueue.lastEffect === null && __DEV__) {
293 console.error('当FC存在PassiveEffect flag时,不应该不存在effect');
294 }
295 root.pendingPassiveEffects[type].push(updateQueue.lastEffect as Effect);
296 }
297}
298
299function commitHookEffectList(
300 flags: Flags,

Callers 2

commitDeletionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected