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

Added explicit null return to completeUnitOfWork() to resolve Flow error #9299

Merged
merged 1 commit into from
Mar 30, 2017

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Mar 30, 2017

completeUnitOfWork causes Flow errors because of this while (true) loop:

function completeUnitOfWork(workInProgress: Fiber): Fiber | null {
  while (true) {
    // ...
  }
}

Here is a smaller repro.

Maybe we should remove or reconsider this while loop but for now I've fixed the issue by adding an explicit null return outside of the loop. (It was blocking a merge in fbsource so I fixed it there and this is an upstream sync.)

@@ -684,6 +684,9 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
return null;
}
}

// Without this explicit null return Flow complains of invalid return type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a todo here so that we come back and remove while (true)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@bvaughn bvaughn merged commit 4f69474 into facebook:master Mar 30, 2017
@bvaughn bvaughn deleted the flow-fix-scheduler branch March 30, 2017 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants