Commit Graph

486 Commits

Author SHA1 Message Date
Dan Abramov
fa98ecba9f Remove Stack-only www shim code (#10019) 2017-06-22 02:38:02 +01:00
Dan Abramov
8e251c5416 Remove unused www shims (#10018)
* Remove unused www shims

* Delete ReactElement.js
2017-06-21 19:10:45 +01:00
Dan Abramov
e68e95284b Remove more isomorphic www shims (#10007) 2017-06-21 17:54:11 +01:00
Andrew Clark
dcc02dd0f1 Task work inside batched updates is always sync, even for initial mounts
Behavior now matches Stack. It's unfortunate that this prevents us
from unifying SynchronousPriority and TaskPriority.
2017-06-19 09:53:19 -07:00
Andrew Clark
812244b57a Remove Animation priority
There's no advantage to scheduling updates with animation priority
versus scheduling sync work inside requestAnimationCallback. So we can
remove all the animation-specific code. Now there's only one type of
callback.
2017-06-19 09:53:19 -07:00
Andrew Clark
6a0c56cffc ReactNoop.flush methods return an array of yielded values
Allows us to make assertions on the values that are yielded when
performing work. In our existing tests, we do this manually by pushing
into an array.

ReactNoop.flushThrough extends this concept. It accepts an array of
expected values and flushes until those values are yielded.
2017-06-19 09:53:19 -07:00
Dominic Gannaway
54e8478a3d Move out more ReactDOM FB shims (#9987)
* move out further ReactDOM shims from FB

* fixed a typo
2017-06-16 15:41:47 +02:00
Dominic Gannaway
52e13922b5 removes Synthetic event forwarding module shims (#9945) 2017-06-15 17:07:34 +01:00
Dan Abramov
310a6c4fc1 Wrap all non-UMD DEV bundles into a condition (#9969)
* Wrap all non-UMD DEV bundles into a condition

* Update header.js

* Create header.js
2017-06-15 00:53:22 +01:00
Bogdan Chadkin
29eb21dd04 Prevents adding units to css custom properties (#9966)
* Prevents adding units to css custom properties

* Fix code style

* Optimize custom property checking

* Prevents adding units to css custom properties in markup creation

* Update passing tests

* Fix argument name and reuse check in DEV
2017-06-14 23:15:09 +01:00
Dan Abramov
7dc27d35c1 Streamline Fiber/Stack testing and bundling setup a little bit (#9964)
* Remove internal forwarding modules for /lib/

* Add *Entry suffix to all entry points

* Don't bundle ReactNativeFeatureFlags since it's shimmed

* Delete TestRendererStack

* Switch tests at forwarding modules rather than via Jest

* Share mocks between regular and equivalence fixtures

* Rename environment flag to be more generic

* Remove accidental variable name change

* Minor naming changes for consistency

Files that have two versions get the engine in variable name.
2017-06-14 22:10:33 +01:00
Taehwan, No
35ae38db2f Remove addons path deleted in #9209 (#9921) 2017-06-11 20:23:40 +01:00
Dan Abramov
7cd6fd2bc1 Don't build ReactDOMServerStack (#9916) 2017-06-10 18:08:05 +01:00
Dan Abramov
2d9d4f6349 Return empty static markup for null components (#9907) 2017-06-09 16:32:00 +01:00
Dominic Gannaway
d13f07925f Add support for implicitly mocked components using ReactServerRenderer (#9906)
* adds the fix (from stack) and adds a test

* updated name of test and ran fiber script
2017-06-09 16:27:00 +01:00
Dan Abramov
47731c9f74 16.0.0-alpha.13 2017-06-09 15:00:01 +01:00
Dominic Gannaway
eadc2b1b7f remove alder32.js (#9905) 2017-06-09 15:19:16 +02:00
Dan Abramov
5c6a496d98 Inline some internals, reduce shared/ utilities between isomorphic and renderers (#9903)
* Make ReactControlledValuePropTypes DEV-only

* Remove canDefineProperty

This breaks IE8. We don't support it.

* Remove getNextDebugID

It was added temporarily to avoid Stack shared state issues across renderers.
Not a problem anymore.

* Make KeyEscapeUtils.unescape() DEV-only

* Remove unused deprecated() module

It's unlikely we'll deprecate anything else on React.* object soon.

* Inline getIteratorFn at the call sites

* Inline ReactElementSymbol

* Inline KeyEscapeUtils into Children and move the file into Stack

It's only used in one place in isomorphic.
It's used more broadly in Stack so we move it there to die.

* Update artifacts

* Reorder declarations for consistency

* Fix Flow
2017-06-09 12:41:50 +01:00
pingan1927
8ab56e5c8b [#9712] fix <input type="number" /> value '.98' should not be equal to '0.98'. (#9714)
* [#9712] fix <input type="number" /> value ".98" should not be equal to "0.98".

* fix eslint error

* fix label error
2017-06-08 21:27:17 -04:00
Dan Abramov
9ff53dd0f4 Rebuild sizes 2017-06-09 00:47:49 +01:00
Dan Abramov
6ab0531d68 Exclude Stack from DOMServerStream (#9896) 2017-06-08 19:41:02 +01:00
Flarnie Marchan
045e5bce35 Add check for string and null 'rootElement' in ReactDOMFiber (#9869)
* Add check for string and null 'rootElement' in ReactDOMFiber

**what is the change?:**
Before we call 'rootElement.getAttribute' we check that the method is
defined.

**why make this change?:**
There is an internal use case I found where 'rootElement' is a string
and null at different points as the page is rendered.

It looks like this method was added as part of support for re-hydration
of server-side rendered content. I can't imagine we would want to reuse
content if the rootnode is a string or null. Not sure if we want an
earlier check that it's an element before this point.

**test plan:**
`yarn test`
and I manually tested this fix in the internal case where it was
breaking

* Add test and improve check for non-element rootElement

**what is the change?:**
We use the nodeType to check that we have the correct type of
rootElement, and we added a unit test.

**why make this change?:**
Improve this solution to the problem.

**test plan:**
`yarn test`

* run ./scripts/fiber/record-tests
2017-06-07 07:51:05 -07:00
Dan Abramov
34927ea04f Remove useCreateElement flag (#9873)
* Remove useCreateElement flag

* Use Circle node #3 for ESLint
2017-06-07 13:22:26 +01:00
Sebastian Markbåge
262b9c72f5 Don't hydrate any properties other than event listeners and text content (#9858)
* Don't hydrate any properties other than event listeners and text content

This strategy assumes that the rendered HTML is correct if the tree lines
up. Therefore we don't diff any attributes of the rendered HTML.

However, as a precaution I ensure that textContent *is* updated. This
ensures that if something goes wrong with keys lining up etc. at least
there is some feedback that the event handlers might not line up. With
what you expect. This might not be what you want e.g. for date formatting
where it can different between server and client.

It is expected that content will line up. To ensure that I will in a follow
up ensure that the warning is issued if it doesn't line up so that in
development this can be addressed.

The text content updates are now moved to the commit phase so if the tree
is asynchronously hydrated it doesn't start partially swapping out. I use
the regular update side-effect with payload if the content doesn't match up.

Since we no longer guarantee that attributes is correct I changed the
bad mark up SSR integration tests to only assert on the textContent
instead.

* Hydrate text node if possible

Currently we're never matching text nodes so we need to properly branch.
2017-06-06 15:19:38 -07:00
Brian Vaughn
7b16a46e0c Updated label in build-script (#9871)
Changed from "STARTING" to "BUILDING"
2017-06-06 14:54:35 -07:00
Dan Abramov
f50c4c9a43 Stop building ReactTestRendererStack (#9870)
* Stop building ReactTestRendererStack

We no longer use it.

* Remove now-unused sizes in JSON stats
2017-06-06 22:23:16 +01:00
Flarnie Marchan
30e6c6c9c9 Tweak syntax in rollup build script (#9852)
* Tweak syntax in rollup build script

@bvaughn and I already discussed this.

**test plan:**
`yarn build`

* Remove JSDoc comments

**what is the change?:**
removing some comments

**why make this change?:**
The code is basically self explanatory and these comments could get out
of sync.

**test plan:**
Visual inspection, `yarn build` and `yarn test`

**issue:**
https://github.com/facebook/react/issues/9398
2017-06-06 07:26:47 -07:00
Ben Alpert
9d07ea7105 Remove reactComponentExpect (#9856)
Legacy.
2017-06-05 16:42:56 -07:00
Sebastian Markbåge
195aa65198 Disable tests of recovering from node.normalize() (#9853)
According to #9836 we're intentionally chosing to not support this until
we have better proof of this being a big need. E.g. to protect against
extensions. In a way that it's not better to push extensions to be fixed.
2017-06-05 16:46:26 -04:00
Edvin Erikson
b9ddd206f9 Fiber SSR tests (#9846) 2017-06-04 15:44:24 -07:00
Brian Vaughn
5f5cfe80f2 Removed unnecessary RN fiber "topsecret-" prefix (#9837)
* Removed RN fiber 'topsecret-' prefix
* Added a test to ensure that duplicate view-names can't be registered with createReactNativeComponentClass
2017-06-02 07:57:28 -07:00
Sebastian Markbåge
9dcc60af33 Delete logTopLevelRenders flag and console timing (#9825)
This was mostly used for timing of initial mounts. However, we haven't
implemented that in Fiber and yet nobody has complained despite running
without it. Further more the update tracks any update within the tree,
not just updates to the props of the top level. This is much less useful
due to the variation.

I could make this track initial mounts too but it's a bit awkward so I'd
rather just delete it if possible. We can run the full profiling mode if
we want more coverage.
2017-06-01 13:00:45 -04:00
Nathan Hunzaker
74044e0eba Inputs should not mutate value on type conversion (#9806)
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;
```
2017-05-30 15:25:44 -05:00
Dustan Kasten
80bdebc1f9 Fix ReactFiberReconciler annotation to include PI (#8751)
* Fix ReactFiberReconciler annotation to include `PI`

https://github.com/facebook/react/pull/8628#issuecomment-271970297

* Make getPublicInstance type safe

* attempting to trigger the issue @sebmarkbage described

https://github.com/facebook/react/pull/8751#discussion_r95669118

* Unify renderer-specific getPublicInstance with getRootInstance

* Switch on fiber type HostComponent for getPublicRootInstance

* Fix test that was too dynamic (and failing)

* Use PI in reconciler public API

* Prettier
2017-05-30 20:15:48 +01:00
Dan Abramov
2b44565fca Don't build some stack bundles (#9812)
* Don't build ReactDOMStack and ReactARTStack bundles

* Regenerate results.json
2017-05-30 15:49:32 +01:00
Dan Abramov
fedb2ff8ec Remove createClass, PropTypes, DOM factories, and createMixin from React object (#9788) 2017-05-30 15:35:30 +01:00
Flarnie Marchan
4ef8865120 Fix externalization of 'lowPriorityWarning' in fb builds (#9790)
**what is the change?:**
 - Add two more special cases for 'lowPriorityWarning' in 'modules.js',
   treating it the same as 'ReactCurrentOwner'.

**why make this change?:**
Without this, the build was including 'lowPriorityWarning' seemingly both as an external module and as part of the bundle.

**test plan:**
Ran `yarn build` and inspected the `React-dev` build. `lowPriorityWarning` did not get bundled in this time.

**issue:**
None yet - @gaearon flagged this for me directly.
2017-05-26 10:35:39 -07:00
Flarnie Marchan
e6af1580fa Update print warning script for low priority warning (#9756)
* Add back caught error and other checks to 'lowPriorityWarning'

**what is the change?:**
This change makes 'lowPriorityWarning' an exact copy of 'warning.js' from
e66ba20ad5/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`

**issue:**

* Update 'print-warnings' script to include 'lowPriorityWarning' output

**what is the change?:**
We print the logs from 'lowPriorityWarning' as well as 'warning' from the 'print-warnings' script.

NOTE: This PR is branching off of https://github.com/facebook/react/pull/9754

**why make this change?:**
We want to use the same process of white/blacklisting warnings with 'lowPriorityWarning' that we do with 'warning'.

**test plan:**
This is not super easy to test unless we are doing a sync with FB afaik. I plan on running a sync in the next few days, or next week at latest, for the sake of not landing big things on a Friday. That will be the actual test of this.

**issue:**
https://github.com/facebook/react/issues/9398
2017-05-26 07:47:49 -07:00
Dan Abramov
c632e58da6 Update numbers 2017-05-26 14:32:26 +01:00
Brian Vaughn
3630bf3559 Corrected a stubbed modules problem for RN fiber bundle (#9784) 2017-05-26 11:15:37 +01:00
Sebastian Markbåge
9c7a312d7c Hydration of previously rendered server markup (#9580)
* Don't double validate the DOM container

The warnings need to check a valid container but that should happen in
unstable_renderSubtreeIntoContainer too so might as well move it in.

* Hydrating DOM

Hydrates a server-rendered DOM tree by traversing it and connecting up the nodes if they match. Attributes are not diffed. They're assumed to be accurate on matching nodes.

* Remove meta data filtering from test

Because the current server renderer includes the meta data, it remains in a revived tree.

* Annotate because Flow

* Don't track insertion effects if we're going to hydrate

During initial mount, we should not track Placement

* Fix up test cases to ignore errors that we no longer throw

TODO make these warnings instead.

* Correctly track hydration state inside a newly inserted tree

When we don't match the first hydration node, we'll do an insertion.
Currently we keep the next hydratable sibling so that we know where to
pick up once we're done with the insertion. Unfortunately this makes the
nodes inside the insertion think that there's a node to hydrate.

I used to check for the direct parent but that doesn't work on nested host components.

We need to instead keep track of that we're in an hydration context but
we're not currently hydrating. Once we pop passed the inserted node can
we resume hydrating.

* Hacky fix to isMounted

isMounted checks whether a component is inside a Placement. During
hydration we ideally don't do any Placements if hydration matches the tree.

To work around this I use the Placement flag on the root, which isn't used
for anything else. But only temporarily while we're hydrating. Then reset
it before committing.

* Record tests

* Comments
2017-05-25 15:19:19 -04:00
Dan Abramov
63cd93af07 Fix Prettier 2017-05-25 19:34:14 +01:00
Dan Abramov
7494e0485d Don't strip error messages from builds (#9778) 2017-05-25 18:56:18 +01:00
Dominic Gannaway
492f7a8200 extractErrors -> extract-errors (#9777) 2017-05-25 19:49:58 +02:00
Brian Vaughn
824d22c9d9 Prevent fiber from leaking into RN stack renderer (#9775)
Since stripEnvVariables was used to replace __DEV__ references, I assumed it (and other plugins) we run before requires statements were processed. Obviously I was wrong 😬 and as a result, the RN Stack and Fiber builds were way too large. This is an attempt to mimic the approach taken with DOM renderer and stub out modules that we explicitly don't want to include.

The alternative to this would have been to fork findNodeHandle, NativeMethodsMixin, ReactNativeBaseComponent, etc. and essentially avoid using the feature flag. That didn't seem tenable. The previous injection approach also doesn't work here because the circular references it resulted in caused Rollup to choke when creating the modules.
2017-05-25 18:14:46 +01:00
Tom Occhino
7b5bdc14d8 Remove build time extractErrors message when error codes can't be found (#9555)
* Remove error message when error codes cannot be found

* Re-record fiber tests to fix CI
2017-05-25 17:07:55 +01:00
Brian Vaughn
108a395f4e Strip comments from UMD_PROD and NODE_PROD builds, not FB_PROD (#9776)
This regressed with the recent addition of RN_* bundles. I was accidentally stripping comments from FB_PROD when I meant to do the opposite. This corrects that mistake.

No significant bundle size change occurs when re-running this build against the version prior to the RN_* bundles.
2017-05-25 16:24:05 +01:00
Brian Vaughn
c22b94f14a ReactNative flat renderer bundles (#9626)
* Split ReactNativeFiber into separate ReactNativeFiberRenderer module
Hopefully this is sufficient to work around Rollup circular dependency problems. (To be seen in subsequent commits...)

* Split findNodeHandle into findNodeHandleFiber + findNodeHandleStack
This allowed me to remove the ReactNative -> findNodeHandle injections, which should in turn allow me to require a fully-functional findNodeHandle without going through ReactNative. This will hopefully allow ReactNativeBaseomponent to avoid a circular dependency.

* Un-forked findNodeHandle in favor of just inlining the findNode function impl

* takeSnapshot no longer requires/depends-on ReactNative for findNodeHandle
Instead it uses the new, renderer-specific wrappers (eg findNodeHandleFiberWrapper and findNodeHandleStackWrapper) to ensure the returned value is numeric (or null). This avoids a circular dependency that would trip up Rollup.

* NativeMethodsMixin requires findNodeHandler wrapper(s) directly rather than ReactNative
This works around a potential circular dependency that would break the Rollup build

* Add RN_* build targets to hash-finle-name check

* Strip @providesModule annotations from headers for RN_* builds

* Added process.env.REACT_NATIVE_USE_FIBER to ReactNativeFeatureFlags
This is kind of a hacky solution, but it is temporary. It works around the fact that ReactNativeFeatureFlag values need to be set at build time in order to avoid a mismatch between runtime flag values. DOM avoids the need to do this by using injection but Native is not able to use this same approach due to circular dependency issues.

* Moved a couple of SECRET exports to dev-only. Removed SyntheticEvent and PooledClass from SECRET exports. Converted Rollup helper function to use named params.

* Split NativeMethodsMixins interface and object-type

* Add @noflow header to flat-bundle template to avoid triggering Flow problems
When Flow tries to infer such a large file, it consumes massive amounts of CPU/RAM and can often lead to programs crashing. It is better for such large files to use .flow.js types instead.

* NativeMethodsMixin and ReactNativeFiberHostComponent now share the same Flow type

* Collocated (externally exposed) ReactTypes and ReactNativeTypes into single files to be synced to fbsource. ReactNativeFiber and ReactNativeStack use ReactNativeType Flow type

* Build script syncs RN types and PooledClass automatically

* Added optional sync-RN step to Rollup build script

* Added results.json for new RN bundles
2017-05-24 17:06:30 +01:00
Flarnie Marchan
6ac91d24c4 Improve low priority warning (#9754)
* Add back caught error and other checks to 'lowPriorityWarning'

**what is the change?:**
This change makes 'lowPriorityWarning' an exact copy of 'warning.js' from
e66ba20ad5/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`

**issue:**

* Update results.json

* Run prettier
2017-05-24 07:55:00 -07:00
Flarnie Marchan
964c263d8f Downgrade deprecation warnings from errors to warnings (#9650)
* Initial regeneration of results.json

**what is the change?:**
We ran `yarn build` and updated the perf. stats record.

**why make this change?:**
Some commits have landed without updating this. By getting an initial update, I can run the build script again after my changes and see any size regressions.

* 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

* Make state mutations an error, not low-pri warning

**what is the change?:**
Even though this is a "deprecation" warning, we still want to use 'console.error' for it.

**why make this change?:**
- It's not likely to come up now, hopefully, because this warning has been present for some time
- This will cause real issues in production if ignored

**test plan:**
`yarn test` - we did fix one test which failed bc of this change

**issue:**
https://github.com/facebook/react/issues/9398

* Fix test of assigning to this.state that was only passing in fiber

**what is the change?:**
updated a unit test for assigning directly to state; it once again raises an error and not a warning.

**why make this change?:**
So that tests pass

**test plan:**
 REACT_DOM_JEST_USE_FIBER=1 yarn run test

**issue:**

* Update results.json
2017-05-23 09:35:42 -07:00