Skip to content

Commit

Permalink
fix: 调整描述
Browse files Browse the repository at this point in the history
  • Loading branch information
jaluik committed Mar 2, 2024
1 parent 1e71a14 commit 2c90383
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/main/fibertree-prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export function createUpdate(eventTime: number, lane: Lane): Update<*> {
): Lane {
const current = container.current;
const eventTime = requestEventTime();
const lane = requestUpdateLane(current); // 根据当前时间, 创建一个update优先级
const lane = requestUpdateLane(current); // 根据当前fiber对象, 创建一个update优先级
const update = createUpdate(eventTime, lane); // lane被用于创建update对象
update.payload = { element };
enqueueUpdate(current, update);
Expand All @@ -237,17 +237,17 @@ const classComponentUpdater = {
isMounted,
enqueueSetState(inst, payload, callback) {
const fiber = getInstance(inst);
const eventTime = requestEventTime(); // 根据当前时间, 创建一个update优先级
const lane = requestUpdateLane(fiber); // lane被用于创建update对象
const update = createUpdate(eventTime, lane);
const eventTime = requestEventTime();
const lane = requestUpdateLane(fiber); // 根据当前fiber对象, 创建一个update优先级
const update = createUpdate(eventTime, lane);// lane被用于创建update对象
update.payload = payload;
enqueueUpdate(fiber, update);
scheduleUpdateOnFiber(fiber, lane, eventTime);
},
};
```
可以看到, 无论是`应用初始化`或者`发起组件更新`, 创建`update.lane`的逻辑都是一样的, 都是根据当前时间, 创建一个 update 优先级.
可以看到, 无论是`应用初始化`或者`发起组件更新`, 创建`update.lane`的逻辑都是一样的, 都是根据当前 fiber 对象, 创建一个 update 优先级.
[requestUpdateLane](https://github.com/facebook/react/blob/v17.0.2/packages/react-reconciler/src/ReactFiberWorkLoop.old.js#L392-L493):
Expand Down

0 comments on commit 2c90383

Please sign in to comment.