Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beginWork和completeWork的疑问 #118

Open
liuyisnake opened this issue Aug 11, 2022 · 0 comments
Open

beginWork和completeWork的疑问 #118

liuyisnake opened this issue Aug 11, 2022 · 0 comments

Comments

@liuyisnake
Copy link

https://react.iamkasong.com/process/reconciler.html#%E4%BE%8B%E5%AD%90

看图上所示的每个component都会执行到beginWork和completeWork,但实际上并不是这样的
completeWork只有在child没有的时候才会执行,然后找到fiber树上一个有slibing的组件执行beginWork
这样并不是所有组件都会有completeWork

尝试打印了下自己的代码大概如下

beginWork App
scheduler.development.js:468 beginWork RecoilRoot
scheduler.development.js:468 beginWork RecoilRoot_INTERNAL
2scheduler.development.js:468 beginWork undefined
scheduler.development.js:468 beginWork Batcher
scheduler.development.js:468 completeUnitOfWork Batcher
scheduler.development.js:468 beginWork GlobalThemeProvider
scheduler.development.js:468 beginWork undefined
scheduler.development.js:468 beginWork ThemeProvider
2scheduler.development.js:468 beginWork undefined
scheduler.development.js:468 beginWork CssBaseline
scheduler.development.js:468 beginWork LanguageProvider
scheduler.development.js:468 beginWork undefined
scheduler.development.js:468 beginWork ThemeProvider
scheduler.development.js:468 beginWork undefined
scheduler.development.js:468 beginWork Initer
scheduler.development.js:468 beginWork SnackbarProvider
scheduler.development.js:468 beginWork undefined
scheduler.development.js:468 beginWork AxiosIniter
scheduler.development.js:468 completeUnitOfWork AxiosIniter
scheduler.development.js:468 beginWork null
scheduler.development.js:468 completeUnitOfWork null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant