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

Update Flow and fix issues #8006

Merged
merged 1 commit into from
Oct 18, 2016
Merged

Update Flow and fix issues #8006

merged 1 commit into from
Oct 18, 2016

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Oct 18, 2016

This updates Flow and fixes issues I found trying to sync React to www.

export type TestRendererOptions = {
createNodeMock: (element: ReactElement) => any,
createNodeMock: (element: ReactElement<any>) => any,
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is public API so I needed to use the "public" ReactElement definition provided by Flow. Otherwise tests in www fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don’t have a good understanding of the difference between ReactElement<*> and ReactElement<any>, though I think that ReactElement<*> allows Flow to infer more. Does that matter or nah?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't understand either 😄 . But at least it passes.

receiveComponent: any,
getName: () => string,
getPublicInstance: any,
_currentElement: ReactElement,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only change is adding _currentElement here.

Copy link
Contributor

Choose a reason for hiding this comment

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

With the Shared comment it looks like this is saying that the lifecycles are shared between the ReactCompositeComponent and ReactDOMComponent. Is that true?

Copy link
Collaborator Author

@gaearon gaearon Oct 18, 2016

Choose a reason for hiding this comment

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

Yes, those methods are shared. mountComponent/receiveComponent/unmountComponent is the "base" component API, DOMComponent and CompositeComponent implement it in different ways.

@@ -212,7 +212,7 @@ function mountSafeCallback(
callback: ?Function
): any {
return function() {
if (!callback || (context.isMounted && !context.isMounted())) {
if (!callback || (typeof context.isMounted === 'function' && !context.isMounted())) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Flow now errors on calling non-callables.

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn’t Flow understand this to be a function if it exists? https://github.com/facebook/flow/blob/master/lib/react.js#L74

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

¯_(ツ)_/¯

@iamdustan
Copy link
Contributor

This supersedes @jeffmo’s PR #7841?

@gaearon
Copy link
Collaborator Author

gaearon commented Oct 18, 2016

I didn't see that one but it looks like mine fixed the issues in it so yes.

@gaearon gaearon mentioned this pull request Oct 18, 2016
@gaearon
Copy link
Collaborator Author

gaearon commented Oct 18, 2016

@iamdustan Can you review this plz?

@iamdustan
Copy link
Contributor

If by review you mean ask a lot of questions: sure 😄

@gaearon
Copy link
Collaborator Author

gaearon commented Oct 18, 2016

I want to get this in but everybody is asleep. I trust your judgement, just me know if changes look correct to you and I'll merge.

@gaearon
Copy link
Collaborator Author

gaearon commented Oct 18, 2016

Uh. Why can't I reproduce this locally?

screen shot 2016-10-18 at 15 00 30

@iamdustan
Copy link
Contributor

npm install compared to yarn install?

@chicoxyzzy
Copy link
Contributor

@gaearon
Copy link
Collaborator Author

gaearon commented Oct 18, 2016

I ran npm install locally. Will try again.

@gaearon
Copy link
Collaborator Author

gaearon commented Oct 18, 2016

@chicoxyzzy I found that one but then I don't understand how #7841 passed.

@iamdustan
Copy link
Contributor

My current thinking on why this passed locally but not on Travis is because travis had cached the previous npm install with fbjs@0.8.4 and bumping to 0.8.5 forced travis to update.

@iamdustan
Copy link
Contributor

This change looks legit to me.

@gaearon gaearon added this to the 15-next milestone Oct 18, 2016
@gaearon
Copy link
Collaborator Author

gaearon commented Oct 18, 2016

@iamdustan Thanks!

@gaearon gaearon merged commit 9bfa45b into facebook:master Oct 18, 2016
@gaearon gaearon deleted the update-flow branch October 18, 2016 14:26
@gaearon gaearon removed this from the 15-next milestone Jan 6, 2017
jackjocross added a commit to jackjocross/react that referenced this pull request Jan 13, 2017
jackjocross pushed a commit to jackjocross/react that referenced this pull request Jan 13, 2017
gaearon pushed a commit that referenced this pull request Jan 23, 2017
* devDependencies: add core-js and es6-symbol polyfill for tests

* Update Flow and fix issues (#8006)

* Add npm v4.0.0 support (#8082)

* Add support for node v7 (#8135)

* Upgrade ESLint and dependencies, fix new lint errors, switch Travis to Yarn (#8309)

* Update ESLint to 3.10.2

Also pull in fbjs for extending properly, per @zpao. This also disables consistent-return, which has about 80 failing cases in React currently. If we'd like to turn this back on, we should do it separately and fix all the call sites properly (rather than just adding 'return undefined;' everywhere, which adds no value.

Fixes to all existing lint errors plus an update for yarn.lock to follow.

* Update yarn.lock after the eslint update.

* Fix all new eslint failures

Unfortunately I had to add three eslint-disable-next-line instances. All have explanations inline.

* Switch Travis to use yarn instead of npm

* Update all Jest packages to 17.x (#8327)

* Update all Jest packages to 17.x, cache babel-jest transforms

* Remove the caching

Looking at the other builds it doesn't seem to actually be that necessary.  The bottleneck is executors, not build time.

* Remove unnecessary package, fix fiber test runner

* Regenerate yarn lockfile

* Update Flow to 0.37.0 (#8608)

Nothing really changes.

* Update to Jest 18 (#8621)

* mockImpl -> mockImplementation

D4329549

* Fixed linting errors

* circle.yml and circleci scripts

* Update Flow and fix issues (#8006)

* Fixed flow errors

* Updated shrinkwrap

* Removed unnecessary change

* Added jest --runInBand flag

* Removed ReactDOMFiber changes
gaearon pushed a commit that referenced this pull request Jan 23, 2017
* devDependencies: add core-js and es6-symbol polyfill for tests

* Update Flow and fix issues (#8006)

* Add npm v4.0.0 support (#8082)

* Add support for node v7 (#8135)

* Upgrade ESLint and dependencies, fix new lint errors, switch Travis to Yarn (#8309)

* Update ESLint to 3.10.2

Also pull in fbjs for extending properly, per @zpao. This also disables consistent-return, which has about 80 failing cases in React currently. If we'd like to turn this back on, we should do it separately and fix all the call sites properly (rather than just adding 'return undefined;' everywhere, which adds no value.

Fixes to all existing lint errors plus an update for yarn.lock to follow.

* Update yarn.lock after the eslint update.

* Fix all new eslint failures

Unfortunately I had to add three eslint-disable-next-line instances. All have explanations inline.

* Switch Travis to use yarn instead of npm

* Update all Jest packages to 17.x (#8327)

* Update all Jest packages to 17.x, cache babel-jest transforms

* Remove the caching

Looking at the other builds it doesn't seem to actually be that necessary.  The bottleneck is executors, not build time.

* Remove unnecessary package, fix fiber test runner

* Regenerate yarn lockfile

* Update Flow to 0.37.0 (#8608)

Nothing really changes.

* Update to Jest 18 (#8621)

* mockImpl -> mockImplementation

D4329549

* Fixed linting errors

* circle.yml and circleci scripts

* Update Flow and fix issues (#8006)

* Fixed flow errors

* Updated shrinkwrap

* Removed unnecessary change

* Added jest --runInBand flag

* Removed ReactDOMFiber changes
acusti pushed a commit to brandcast/react that referenced this pull request Mar 15, 2017
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.

4 participants