Timing of effects
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
Although
useEffectis deferred until after the browser has painted, it's guaranteed to fire before any new renders. React will always flush a previous render's effects before starting a new update.
Is this true in both concurrent and non-concurrent mode. It would appear intuitively that these two call-sites in non-concurrent mode would be deterministic:
ReactDOM.render(<Foo>, container)
ReactDOM.render(<Foo>, container)
That is it would invoke a new render before the effect in the first render has been invoked.
If so would it make more sense to specify it is only in relation to effects i.e previous effects are guaranteed to run before future effects.
As it stands, it looks appears as though the "render" call-site is non-deterministic in non-concurrent.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查文档中关于 effect 会在新的 render 之前被 flush 的引述,然后将其措辞与两处 ReactDOM.render 调用点以及 concurrent 和 non-concurrent 两种行为进行比较。完成标准是文档明确说明所支持的保证,并解决该保证是普遍适用于 render,还是仅适用于 effect 的顺序。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100