* [#9627] Fix create-react-class isMounted ordering issue
Split the IsMountedMixin in two so that the __isMounted flag is set to false after componentWillUnmount is executed in mixins and the component.
* Revert changes to integration test
* Test 'create-react-class' with fixtures
NOTE: Never going to merge this commit, but I may cherry-pick it onto
branches in order to test fixes for issue #9765
**what is the change?:**
Require and use the UMD bundles of 'create-react-class' in three
fixtures to test the three supported uses;
- test Global JS with globals.html
- test AMD with requirejs.html
- test CommonJS with webpack-alias
**why make this change?:**
To test https://github.com/facebook/react/pull/9761 and other PRs fixing https://github.com/facebook/react/issues/9765
**test plan:**
Manual testing;
- cd into the directory in fixtures
- run the build step if needed
- open the file
**issue:**
https://github.com/facebook/react/issues/9765
* Rename fixtures testing create-react-class
**what is the change?:**
Renamed some fixtures.
**why make this change?:**
This is part of setting up manual tests of the add-ons we are fixing.
**test plan:**
`cd fixtures && node ./build-all.js` and manually open the renamed
fixtures.
**issue:**
https://github.com/facebook/react/issues/9765
* Prettify the unminified UMD build of `react-linked-input`
**what is the change?:**
`prettier addons/react-linked-input/react-linked-input.js | pbcopy` and
replaced the contents of the file.
**why make this change?:**
I am manually tweaking this file and want it to be more readable.
**test plan:**
about to set up manual testing of this with fixtures. I expect that
right now only the use of it as a global will work, and subsequent
commits will fix the AMD and CommonJS use cases.
**issue:**
https://github.com/facebook/react/issues/9765
* Test state of `react-linked-input` and `create-fragment` before fix
**what is the change?:**
Setting up the fixtures to enable manual testing of the
`react-linked-input` and `create-fragment` UMD builds.
This was a painstaking and frustrating process and we need something
better before making any more fixes to addons. Here is roughly what I
did;
- add 'console.log' statements to the add-on to confirm that you've loaded the right build case
- copy the add-on into 'build/packages' so that the 'webpack-alias' can find it.
- make copies of each of the following three fixtures for each add-on you want to test, renaming them to specify what you are testing:
- globals.js
- requirejs.js
- webpack-alias/*
- modify those fixtures to use the add-on you intend to text
**why make this change?:**
We need to verify the current state of the bug before fixing it, to
confirm that the change actually is fixing the bug.
**test plan:**
`open fixtures/globals-with-create-react-fragment.html`
`open fixtures/globals-with-react-linked-input.html`
`open fixtures/requirejswith-create-react-fragment.html`
`open fixtures/requirejswith-react-linked-input.html`
`cd fixtures/webpack-aliaswith-create-react-fragment/ && yarn build && open index.html`
`cd fixtures/webpack-aliaswith-react-linked-input/ && yarn build && open index.html`
**issue:**
https://github.com/facebook/react/issues/9765
* Fix missing `React` in `react-linked-input` and `create-fragment`
**what is the change?:**
Manually tweaking the UMD builds for both add-ons to include a
dependency on React.
**why make this change?:**
They were broken before for AMD and CommonJS.
For reasons I have not debugged, the CommonJS builds are still broken,
but the AMD is now fixed and globals still work:
```
do 'react-linked-input' and
'create-react-fragment' work?
before after
+ my + my +
en^ironment | fix | fix |
+----------------------------------------
| | |
Global JS | :) yes | :) yes |
+----------------------------------------
| | |
AMD | X no | :) yes |
+----------------------------------------
| | |
CommonJS | X no | X no |
+-------------+-----------+-----------+--
```
**test plan:**
In the previous commit we set up fixtures to manually test these.
**issue:**
https://github.com/facebook/react/issues/9765
* More adjustments to enable testing with fixtures
Not worth explaining - just committing as a 'save point' while I fiddle
with the fixtures.
* Remove all cruft from manually testing addons in fixtures
**what is the change?:**
We forked three of the fixtures into two variations to test two of the
react addons. We also added `console.log` statements to the addons to
verify that we were loading the right build.
This commit cleans it up by
- deleting forked fixtures
- re-adding the original fixtures
- removing `console.log` statements
**why make this change?:**
To get this branch ready for review.
**test plan:**
`cd fixtures && node ./build-all.js` and then check the updated fixtures
manually
**issue:**
https://github.com/facebook/react/issues/9765
* Double to single quotes in 'react-linked-input'
**what is the change?:**
`:%s /"/'/gc`
I left double quotes wrapping cases where we have single quotes in the
string.
**why make this change?:**
I ran the code for the unminified 'react-linked-input' through
'prettier' so it would be easier for me to manually fix the UMD wrapper.
And 'prettier' changed many single quotes into double quotes. @spicyj
pointed out this will be treated differently by the google closure
compiler, and may have semantic differences.
**test plan:**
It's not worth testing imo.
**issue:**
https://github.com/facebook/react/issues/9765
* remove random newline
* Fix missing react in create-react-class
refs #9689
* Modify the 'create-react-class' package to make 'globals' work again
**what is the change?:**
Pass the global 'react' into the global conditional in the UMD build of
'create-react-class'.
**why make this change?:**
Here is the deal:
- @mondwan's original fix does fix the AMD build, but breaks the
'global JS' build.
- My modification makes it work with both AMD and the 'global JS'
build.
- @mondwan's fix seems to have fixed the CommonJS build too, and I
maintained that fix with my modification.
```
Does the 'create-react-class' UMD build work?
Before After After
+ @mondwan's + @mondwan's + @flarnie's
Build System | fix | fix | modification
+---------------------------------------------------------+
| | |
Global JS | :D Success | X Fail | :D Success
| | |
+---------------------------------------------------------+
| | |
AMD | X Fail | :D Success | :D Success
| | |
+---------------------------------------------------------+
| | |
Common JS | X Fail | :D Success | :D Success
| | |
+ + +
```
**test plan:**
The testing for this was really tricky and involves a fragile multi-step
process:
1) Make sure the fixtures are working on your branch
2) Modify some of the fixtures to use 'create-react-class', like in this
commit (you can just cherry-pick it if you are on a branch based on
the 15.* branches) -
https://github.com/flarnie/react/commit/51dcbd5ef164b86bc509ae070a6273758a60e13c
3) Make sure React is set up, and then
`cd fixures && node ./build-all.js`
4) The following fixtures could be used to test the various builds:
- test GlobalJS with `globals.html`
- test AMD with `requirejs.html`
- test CommonJS with `webpack-alias/index.html`
**issue:**
https://github.com/facebook/react/issues/9689
and
https://github.com/facebook/react/issues/9765
* Remove fixtures that only work with Fiber
**what is the change?:**
Removes three directories in the 'fixtures' directory.
**why make this change?:**
These fixtures were designed to work with Fiber, and were accidentally
pulled into this branch. They were causing errors when we try to build
the other fixtures.
**test plan:**
`cd react/fixtures && node ./build-all.js` no longer throws an error
from `fiber-debugger/App.js` - although it still throws another error
**issue:**
https://github.com/facebook/react/issues/9900
* Add back the 'babel-standalone' fixture
**what is the change?:**
Add this fixture back to the 15.6 branch
**why make this change?:**
This fixture is not fiber specific
**test plan:**
`node ./build-all.js` inside of ./fixtures
**issue:**
https://github.com/facebook/react/issues/9900
* Hello 15.6 Release Candidate
**what is the change?:**
We update the versions of all associated React packages when bumping the
version of React.
**why make this change?:**
We want to publish a RC to give folks time to try out the latest version
before it's final.
Why bump the version of every other associated package?
It makes the dependency between them more clear.
There will be cases where we make a fix in React-DOM and it requires
changes in React core. In that case, it will be more clear to people
when we update the versions of both and they remain in sync.
**test plan:**
Visual inspection
**issue:**
https://github.com/facebook/react/issues/9398
* Update a couple more packages versions
**what is the change?:**
Updates version for 'react-dom-factories' package and 'react-addons'
template.
**why make this change?:**
We missed these in the previous commit, which was copying the approach
from https://github.com/facebook/react/pull/9828/files
**test plan:**
Visual inspection, and running the build
**issue:**
https://github.com/facebook/react/issues/9398
* Prepare `react-dom-factories` for publishing
**what is the change?:**
- copies the `React.DOM.*` factory helpers into the package and wraps
them with an IIFE
- set peerDependency on React to latest 15 version
**why make this change?:**
We are deprecating `React.DOM.*` and this provides a fallback option for
those using it.
We just copied the code in order to avoid a circular dependency, which
keeps complexity down since we are supporting every possible build
system.
**test plan:**
TODO -
1. Copy this into one of our fixtures using a UMD/AMD build and see if
it works there.
2. Do an initial publish of the package on npm and then pull it into
CRA, and try it there.
3. Try it in https://github.com/duncanbeevers/jade-react or some other
project that actually uses the `React.DOM.*` helpers, using the
related codemod.
**issue:**
https://github.com/facebook/react/issues/9398
* Fix lints and capitalization of 'reactDOMFactories'
**what is the change?:**
Fixing nits in capitalization, quotes, and defined globals
**why make this change?:**
To get CI passing, consistency, correctness
**test plan:**
see prev. commit
**issue:**
https://github.com/facebook/react/issues/9398
This is a follow-up on
https://github.com/facebook/react/pull/9584#discussion_r115642293. There
is no need to assign the value property of an input if the value
property of the React component changes types, but stringifies to the
same value. For example:
```javascript
DOM.render(<input value="true" />, el)
DOM.render(<input value={true} />, el)
```
In this case, the assignment to `input.value` will always be
cast to the string "true". There is no need to perform this
assignment. Particularly when we already cast the value to a string
later:
```javascript
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
node.value = '' + value;
```
* Improve warning for `React.createClass`
**what is the change?:**
- Explain that this will be removed in v16.0 specifically
- Mention the version number for the drop-in replacement module.
- Link to docs in the blog post about how to migrate
**why make this change?:**
We want to make our deprecation warnings more clear and helpful.
**test plan:**
Visual inspection and `yarn test`
**issue:**
https://github.com/facebook/react/issues/9398
* Widen range of recommended replacement module versions
**what is the change?:**
Instead of recommending specific versions of 'prop-types' and
'create-react-class' we ask folks to use the latest available 15.* version.
**why make this change?:**
The latest version of those plugins, within the 15 version, is the most likely
to be stable. For example, we know that 'react-create-class' is broken for AMD
builds at the current latest version, so once we release a fix then the
recommended version will change.
**test plan:**
Visual inspection
Also fixed some tests.
* Fix typos and things
**what is the change?:**
- `migrade` -> `migrate`
- `15.* prop-types package` -> `v15.* prop-types package`
**why make this change?:**
Correctness
**test plan:**
`yarn test` and visual inspection
**what is the change?:**
`grep -r "react-addons-dom-factories" ./src` and the same in `./packages`
then `%s /react-addons-dom-factories/react-dom-factories/gc`
**why make this change?:**
React dom factories were never part of the 'addons' and we want to minimize the
whole 'addons' thing, since we are deprecating the `React.addons.*` API.
**test plan:**
`yarn test`
and manually look at the README that was updated.
**issue:**
https://github.com/facebook/react/issues/9398
Remove a comment saying `es6`, since this is potentially unclear. We aren't
contrasting to an es5 example here.
Thanks to @gaearon for catching this in review of
https://github.com/facebook/react/pull/9780
* react-create-class -> create-react-class
* Fix issues/bugs introduced by merge conflict resolution
**what is the change?:**
A couple of bugs and holes were introduced when cherry-picking https://github.com/facebook/react/pull/9232 onto the 15.6 branch. This fixes them.
We also needed to add some logic from https://github.com/facebook/react/pull/9399
**why make this change?:**
To keep tests passing and get this change working.
**test plan:**
`yarn test`
**issue:**
https://github.com/facebook/react/issues/9398
* Move component base classes into a single file (#8918)
* More fixes for issues introduced by rebasing
**what is the change?:**
- Remove some outdated 'require' statements that got orphaned in 'React.js'
- Change 'warning' to 'lowPriorityWarning' for 'React.createClass'
- Fix syntax issues in 'React-test'
- Use 'creatReactClass' instead of ES6 class in ReactART
- Update 'prop-type' dependency to use no higher than 15.7 because 15.8 limits the number of warnings, and this causes a test to fail.
- Fix some mixed-up and misnamed variables in `React.js`
- Rebase onto commit that updates deprecation messages
- Update a test based on new deprecation messages
**why make this change?:**
These were bugs introduced by rebasing and tests caught the regressions.
**test plan:**
`yarn test`
**issue:**
https://github.com/facebook/react/issues/9398
* Reset `yarn.lock`
**what is the change?:**
I didn't mean to commit changes to `yarn.lock` except for the `prop-types` and `create-react-class` updates.
**why make this change?:**
To minimize the changes we make to dependency versions.
**test plan:**
`rm -rf node_modules`
`yarn install`
`yarn run build`
`yarn test`
* Run `yarn prettier`
* Improve deprecation warnings by more info and links
**what is the change?:**
Updates the warnings for -
- `React.createMixin` (was never implemented!)
- `React.PropTypes`
- `React.createClass`
- `React.DOM.*`
We never added the warning for `React.createClass` to the 15.5 line, so
a follow-up PR will add that, with a link to docs etc.
Does *not* update the older warnings for -
- Factory.type
- 'isMounted' and 'replaceState'
- ReactPerf
We could do a second pass if we want to improve those three warnings, but for now I don't think they are as hi-pri.
Still TODO:
- Do an initial release of the [`react-addons-dom-factories`](https://github.com/facebook/react/tree/master/packages/react-dom-factories#react-addons-dom-factories) package on npm, making it 1.0.
- Improve the docs for `react-addons-dom-factories` adding documentation and mention the [codemod](https://github.com/reactjs/react-codemod/blob/master/transforms/React-DOM-to-react-dom-factories.js)
**why make this change?:**
- We want to make updating as easy as possible. Warning messages should increase clarity, and in the past they have caused confusion.
**test plan:**
`yarn test` and running these messages past some folks who use React.
**issue:**
https://github.com/facebook/react/issues/9398
* Rephrase deprecation messages for clarity
**what is the change?:**
We rephrased the deprecation messages to clarify that
- these APIs are currently deprecated
- they will be removed in React v16.0
The previous wording implied that they would be deprecated in v16.0.
**why make this change?:**
To make the messages easier to understand.
**test plan:**
Visual inspection
* Add back caught error and other checks to 'lowPriorityWarning'
**what is the change?:**
This change makes 'lowPriorityWarning' an exact copy of 'warning.js' from
https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
where before we had skipped some checks from that module.
- Adds an error which we catch, in order to let people find the error and resulting stack trace when using devtools with 'pause on caught errors' checked.
- Adds check that 'format' argument is passed
**why make this change?:**
- To maintain a closer fork to 'warning.js'
- To allow easier debugging using 'pause on caught errors'
- To validate inputs to 'lowPriorityWarning'
**test plan:**
`yarn test`
* Downgrade deprecation warnings from errors to warnings (#9650)
* Downgrade deprecation warnings from errors to warnings
**what is the change?:**
Swapping out `warning` module for a fork that uses `console.warn`.
It looks like we were using the `warning` module for deprecation notices, *but* there is also a 'deprecated' module designed specifically for deprecation notices.
However, we could not find any place that it was currently used.
Since React's build process is not 100% clear to me, I assume it could still be used somewhere by something and just updated it along with other deprecation notices.
We might consider a follow-up diff that does some clean up here;
- remove 'deprecated' module if it's unused, OR
- use 'deprecated' module for all our current deprecation warnings
**why make this change?:**
- We have had complaints about noisy warnings, in particular after introducing new deprecations
- They potentially cause CI failures
- Deprecations are not really time-sensitive, can ship without breaking your app, etc.
For more context - https://github.com/facebook/react/issues/9395
**test plan:**
`npm run test`
and unit tests for the new modules
and manual testing (WIP)
**issue:**
https://github.com/facebook/react/issues/9395
* Add 'lowPriorityWarning' to ReactExternals
**what is the change?:**
We won't bundle 'lowPriorityWarning' with the rest of React when building for Facebook.
NOTE: A parallel commit will introduce an internal implementation of 'lowPriorityWarning' in Facebook's codebase, to compensate. Will post a comment with the diff number once that is up.
**why make this change?:**
So that the sync between github and Facebook can go more smoothly!
**test plan:**
We will see when I run the sync! But this is a reasonable first step imo.
**issue:**
https://github.com/facebook/react/issues/9398
* Tweaks to get tests passing after cherry-picking PR#9650
**what is the change?:**
- adds 'lowPriorityWarning' for deprecation of '__spread' and 'createMixin'
- tweaks test to check for 'warn' and not 'error'
**why make this change?:**
Both these issues were introduced by merge conflict resolution when cherry-picking this change from master onto 15.6.
**test plan:**
`yarn test`
**issue:**
* Fix mis-written 'require' for 'warning' module
**what is the change?:**
Fixes 'warning' to be required from 'warning'
**why make this change?:**
It was causing the browserify build to crash, because we don't expect to have a path to 'warning'.
**test plan:**
CI
* Only fire input value change events when the value changes (#5746)
* Allow simulated native events to propagate
fixes#7211fixes#6822fixes#6614
we should make sure it doesn't break #3926 any worse (or works with #8438)
* Provide non-standard stack with invalid type warnings
* Include parent stack but mark owner chain as pertinent
* Just parent stack is enough for my needs
Because to avoid noise it is enough to collapse too close frames in the UI.
* functionName => name
* Hide behind a feature flag
- Update examples to no longer use React.DOM
- Add package and documentation entries for react-addons-dom-factories
- Update dom-factories readme
- Set up proxy to intercept React.DOM usage
- Update ReactDOM children tests to use createElement
- Add more specific warning assertion for React DOM factories
- Do not use expectDev in ReactDOMFactories tests
* Remove loose check when assigning non-number inputs
This commit removes a check I added when working on number input
issues where we perform a loose check on an input's value before we
assign it. This prevented controlled text inputs from disallowing
numeric text entry.
I also added a DOM fixture text case.
Related issues:
https://github.com/facebook/react/issues/9561#issuecomment-298394312
* Use strict equality as a guard before assigning input.value
This commit adds back the guard around assigning the value property to
an input, however it does it using a strict equals. This prevents
validated inputs, like emails and urls from losing the cursor
position.
It also adds associated test fixtures.
* Add copy command after build for interup with surge.sh
* Use setProperty when setting style properties
setProperty is faster in all/most modern browsers. It also lets us support CSS variables.
* Only use setProperty when setting CSS variables
* Add test to ensure setting CSS variables do not warn
* Make this PR pretty again
* Run fiber test script
* Update tests to not warn due to moved PropTypes and shallowRenderer
We added some warnings in v15.5 for calling `React.PropTypes` and
calling the shallow renderer from the wrong place. These warnings were
causing test failures, and now they are fixed.
Most of these were for the `React.PropTypes` change.
* tweak from running prettier
* Final tweaks to get tests passing
**what is the change?:**
Updated 'PropTypes' and 'shallow renderer' syntax in a couple more
places to get tests passing.
**why make this change?:**
In order to verify any changes to the 15.6 and 15.* branches in general
we should have tests passing.
**test plan:**
`npm run test`
**issue:**
https://github.com/facebook/react/issues/9410
* Run 'prettier' on the v15.6 branch
This is an easy fix and I'd like this branch to be as similar to master
(v16.0) as possible.
* `npm install --save-dev prettier && yarn prettier`
Checking in the updated `package.json` and `yarn.lock` for the 15.6
branch.
Oddly, running `yarn prettier` updated more files. I thought the
previous commit had covered all `prettier` syntax updates. Will commit
the new changes in a separate commit.
* Ran prettier
More syntax updates to get `prettier` checks passing on the `15.6-dev`
branch, and eventually, on 15-stable.
* Tweak eslint ignore comments to get linter passing
Something with running `prettier` moves or changes these comments in a
way that they were no longer being applied. We tweaked them so that both
'prettier' and 'eslint' pass.
This fixes an issue where if we decided not to create a measurement we would clear ALL measurements from the performance entry buffer due to passing `undefined` as the entry name.
The `.eslintignore` had gotten a merge conflict committed accidentally
at some point, and also was not ignoring the `addons` directory. This
fixes that.
We also had a couple of missing commas that snuck in, and those are
fixed here too.