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

PriorityLevel module no longer being used in Fiber #23

Open
reccanti opened this issue Jan 25, 2018 · 3 comments
Open

PriorityLevel module no longer being used in Fiber #23

reccanti opened this issue Jan 25, 2018 · 3 comments

Comments

@reccanti
Copy link

It looks like the ReactPriorityLevel module was removed as of this commit. It looks like at least the link in the pendingWorkPriority section should be updated to reflect that. Is there anything else in that section that should be removed?

@onstash
Copy link

onstash commented Mar 13, 2018

Hey @acdlite. Thank you for the detailed write up. 😃✋As @reccanti mentioned, ReactPriorityLevel is either absent or has been moved into a different module in the react codebase. Could you point how to fix this? I think this is minor and can be quickly resolved. Thanks again! 😄

@poxrud
Copy link

poxrud commented May 10, 2018

Based on my understanding (I can be wrong) it looks like the concept of priorities is gone for now. Instead we have "Sync" and "Async" units of work.

If you look at the workLoop function we have:

function workLoop(isAsync) {
    if (!isAsync) {
      // Flush all expired work.
      while (nextUnitOfWork !== null) {
        nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
      }
    } else {
      // Flush asynchronous work until the deadline runs out of time.
      while (nextUnitOfWork !== null && !shouldYield()) {
        nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
      }
    }
  }

So basically render everything right away if we're dealing with a regular update, or if it's an async update render it if we have the time to do so.
shouldYield checks if we have enough time to render the current unitOfWork.

@FredrikAugust
Copy link

You can find the different types of levels here though (if I understood the document correctly):

https://github.com/facebook/react/blob/8c67bbf183cc5ae1cab15a8265c612daf80cd86f/packages/scheduler/src/Scheduler.js#L12

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

4 participants