Notes

render lanes

一句话结论:update lane 表示“发生了什么更新”,render lanes 表示“这次 render 要处理哪些更新”;两者不一定相同,因为可能有挂起/插队/过期等情况影响选择。

1. 为什么要区分

  • pendingLanes 里可能混着多种优先级更新
  • 一次 render 通常只挑一组“当前最合适的 lanes”来处理

2. 选择 renderLanes 的关键因素

  • 优先级:先处理更高优先级 lanes
  • 挂起:被 Suspense 挂起的 lanes 可能暂时跳过
  • 过期:等太久的 lanes 会被提升(expired)
  • 纠缠:某些 lanes 需要一起处理(entangled,常见于 Transition 相关)

3. 面试表达要点

  • “renderLanes = 本轮目标集合”
  • “update lane = 更新的身份标签”,用于合并/排序/追踪

关联阅读

cd ..