( fiber: FiberNode, root: FiberRootNode, type: keyof PendingPassiveEffects )
| 276 | } |
| 277 | |
| 278 | function 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 | |
| 299 | function commitHookEffectList( |
| 300 | flags: Flags, |
no outgoing calls
no test coverage detected