Sitelet https://github.com/react/react/pull/9299
Skip to content

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

Merged
bvaughn merged 1 commit into
react:masterfrom
bvaughn:flow-fix-scheduler
Mar 30, 2017
Merged

bvaughn merged 1 commit into
react:masterfrom
bvaughn:flow-fix-scheduler

Conversation

@bvaughn

@bvaughn bvaughn commented Mar 30, 2017

Copy link
Copy Markdown
Contributor

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.)

}
}

// Without this explicit null return Flow complains of invalid return type

Copy link
Copy Markdown
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
Copy Markdown
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 force-pushed the flow-fix-scheduler branch from 434e82b to 5e3ac42 Compare March 30, 2017 22:42
@bvaughn
bvaughn merged commit 4f69474 into react:master Mar 30, 2017
@bvaughn
bvaughn deleted the flow-fix-scheduler branch March 30, 2017 22:45
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
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.

3 participants