Commit Graph
3677 Commits
Author SHA1 Message Date
Andrew ClarkandAndrew Clark 81eef12507 Test that hidden subtrees render/update synchronously
When useSyncScheduling is set to true (as it is in the DOM renderer),
we shouldn't give OffscreenPriority to hidden subtrees. Everything
should be sync/task.
2017-03-01 10:56:31 -08:00
Andrew ClarkandGitHub 0585ee8b22 Merge pull request #9082 from acdlite/nobooleanorstringconstructors
Enforce no boolean or string constructors
2017-03-01 10:55:42 -08:00
Dominic GannawayandGitHub 8bc11649df Merge branch 'master' into remove-stack-dependencies-from-tests 2017-03-01 12:32:36 +00:00
Andrew Clark 1e9812e31b Convert usage of String and Boolean constructors 2017-02-28 18:56:57 -08:00
Sebastian MarkbågeandGitHub e452e33741 providesModule -> explicit requires for cross-package dependencies (#9078)
* Add forwarding modules

* Codemod to use full package path outside of own package

Files that require modules from a different package than their own now
does so by the npm path name instead of the providesModule.

* Codemod fbjs module dependencies

* Fix gulp module mapping config

This is a bit lame but because of our module rewrite we need to white
list all the paths that we don't *don't* want to rewrite.
2017-02-28 18:42:52 -08:00
Ben AlpertandGitHub a269e7ec3f Enable react/jsx-space-before-closing rule (#9077)
We mostly do this but not 100%; I fixed the stragglers here with `./node_modules/.bin/eslint --fix src` and enabled the lint rule.
2017-02-28 09:03:08 -08:00
Dominic Gannaway d2944bb5bf updates test-failing and tests-passing 2017-02-28 15:02:48 +00:00
Dominic Gannaway 04cd2b2a81 refactors/removes stack dependent tests to work with fiber 2017-02-28 15:00:42 +00:00
Sebastian MarkbågeandGitHub e35724a03d Move webcomponents.js polyfill to mocks (#8993)
* Move webcomponents.js polyfill to mocks

I'd like to move it out of shared to make it easier to sync this to RN.
Since this is only used for testing and a polyfill is essentially a mock.
Maybe this makes sense?

Rename to camel case to be consistent with providesModule.

* Update path to ignore in configs
2017-02-27 18:35:05 -08:00
Brian VaughnandGitHub f923adb585 Pass component stack to error boundary handler (#9073)
This information is probably more useful for custom redbox components than the call stack info we are already passing.
2017-02-27 16:53:17 -08:00
Andrew Clark 2c59713f71 Remove invokeGuardedCallbackProd
We weren't using it anywhere except for the test suite. Instead, we can
change the environment flag and run the tests in both environments.
2017-02-24 16:19:29 -08:00
Andrew Clark 7e348acab7 Use invokeGuardedCallback in place of Fiber try-catch blocks
Only in DEV. In production, continue using a local try-catch.
2017-02-24 15:49:33 -08:00
Andrew Clark 13d4574228 invokeGuardedCallback should work when nested
Added a guard in the global error event listener to prevent nested
errors from being captured higher up the stack.

Also found a bug where the DEV version of invokeGuardedCallback would
infinite loop if there were nested invocations with the same name. Fixed
by appending the depth to the fake event name. (I'm actually not sure
why this is necessary.)
2017-02-24 15:49:33 -08:00
Andrew Clark 0304008a65 invokeGuardedCallback returns a thrown error
We can use this more flexible version for error handling in Fiber.

The DEV mode version uses same fake event trick as before to preserve
"break on uncaught exception" behavior when debugging.
2017-02-24 15:49:33 -08:00
Ben AlpertandGitHub 0934ab948d Flatten Text children before rendering (#9063)
From FB-internal D4613844.
2017-02-24 13:40:08 -08:00
Andrew Clark 393cdbc745 Consolidate ReactCurrentFiber and ReactDebugLifeCycle 2017-02-24 11:16:58 -08:00
Andrew Clark d2c28be69b Use ReactDebugLifeCycle to track if we're inside getChildContext 2017-02-24 11:02:21 -08:00
Andrew Clark 309dea5b4c Track which lifecycle method we're in during DEV
Use this to detect setState inside of render instead of relying on
the owner.
2017-02-24 11:02:21 -08:00
Andrew Clark ebfde985d9 Warn about nested renders 2017-02-24 11:02:21 -08:00
Andrew Clark 75ee3c1424 Warn about setState inside getChildContext
Stack uses a module called ReactInvalidSetStateWarningHook, but all it
does is warn about setState inside getChildContext. Doesn't seem worth
keeping around, so I didn't use it for Fiber, but if I'm mistaken I'll
change it.
2017-02-24 11:02:21 -08:00
Andrew Clark 2f3df5f0b3 Warn about setState in render 2017-02-24 11:02:21 -08:00
Andrew Clark ca4325e3ef 16.0.0-alpha.3 2017-02-23 15:36:08 -08:00
Andrew ClarkandGitHub 18217cfede Merge pull request #9054 from acdlite/fiberpreventextensions
[Fiber] Prevent extensions to fiber in DEV
2017-02-23 14:42:16 -08:00
Andrew ClarkandGitHub f3c2d9f308 Merge pull request #9004 from acdlite/proptypescheck
API for checking external objects against React prop types
2017-02-23 14:37:19 -08:00
Maxwel D'souzaandBrandon Dail b81175d37a Removed unnecessary if (#9031) 2017-02-23 15:14:21 -06:00
mdogadailoandBrandon Dail 49840f2e6b Missing onLoad and onError events on image tag (#9042) 2017-02-23 15:05:38 -06:00
Andrew Clark ddf59c403a Prevent extensions to fiber in DEV
Helps us avoid accidentally adding fields to the fiber class
2017-02-23 11:23:44 -08:00
Andrew Clark 03ed3437c9 Fix build config
ReactDebugCurrentFrame is shared state.

checkPropTypes should be imported via the main React export,
not imported directly.
2017-02-23 11:14:15 -08:00
Andrew Clark 0320b8ecb4 Wrap checkPropTypes in DEV conditional so it's stripped out in prod 2017-02-23 11:14:15 -08:00
Andrew Clark e6d6ad3e88 Remove closure in checkReactTypeSpec by tracking stack info globally
There's a lot of overlap between ReactCurrentOwner,
ReactDebugCurrentFrame, and ReactDebugCurrentFiber that should
be consolidated.
2017-02-23 11:14:14 -08:00
Andrew Clark 9993fdd957 Change formatMessage parameter to getStack
Gives us flexibility in the future to deal with the stack and the
message separately.
2017-02-23 11:14:14 -08:00
Andrew Clark 6ff5211dee Remove warnOnRepeat option
Don't need this internally; doubt external users will need it either
2017-02-23 11:14:14 -08:00
Andrew Clark 3746a9dafb Invert dependency between checkPropTypes and checkReactTypeSpec
Expressing checkReactTypeSpec using the public API frees us to move it
to a separate module in the future.
2017-02-23 11:14:14 -08:00
Andrew Clark e4acd12a9b Test that checkPropTypes does not throw or return a value 2017-02-23 11:14:14 -08:00
Andrew Clark 600685bdef Add PropTypes.checkPropTypes API
Allows users to check arbitrary objects against React prop types without
relying on the implementation details of the prop validators themselves.
An example of why this is important: some prop validators may throw,
while others return an error object. Calling a prop validator manually
requires handling both cases. `checkPropTypes` does this for you.
2017-02-23 11:14:14 -08:00
Andrew Clark bef723e47f Remove ReactPropTypeLocationNames module
ReactPropTypeLocationNames was a map of location identifiers to location
display names, for use in warnings. But in practice, this did nothing
except rename "childContext" to "child context." Not worth it, IMO.

Since we are going to add an API for running prop type checks manually,
we need the ability to support arbitrary prop type locations. So
each place that used to accept a ReactPropTypeLocation now just accepts
a string.
2017-02-23 11:14:14 -08:00
Dominic GannawayandGitHub 91e8081cf0 Merge pull request #9045 from trueadm/emptyObject-reference-mismatch-due-to-mocking
[Fiber] fix ensure class components refs get re-assigned to emptyObject on mount
2017-02-23 15:38:10 +00:00
Dominic GannawayandGitHub 23f245173a Merge pull request #9043 from trueadm/fix-fiber-functional-componment-childcontext
[Fiber] adds `childContextTypes` warnings for functional components
2017-02-23 15:37:48 +00:00
Dominic Gannaway bde5df1d76 addressed code in feedback 2017-02-23 15:37:19 +00:00
Dominic Gannaway a99d77e073 added a regression test for factory components 2017-02-23 14:00:02 +00:00
Dominic Gannaway 925743bfc9 reverted ReactDOMFeatureFlags 2017-02-23 13:40:16 +00:00
Dominic Gannaway e7d7809eb1 reverted the getChildContext warning from showing on functional components in Fiber 2017-02-23 13:39:08 +00:00
Dominic Gannaway 25f4abc9d5 mountClassInstance() now re-assigns instance.refs to emptyObject 2017-02-23 12:58:37 +00:00
Dominic Gannaway a749083b85 fixed comment that was incorrect 2017-02-23 12:42:21 +00:00
Dominic Gannaway 724ae9b35a reverts previous changes to inlining requires and fixes test suite instead 2017-02-23 12:31:58 +00:00
Ben AlpertandGitHub 5f6f3277f5 Add test for hack to stop bubbling (#8922) 2017-02-22 14:02:10 -08:00
Ben AlpertandGitHub 9503abe5c7 Pass errorBoundary to logCapturedError (#9050) 2017-02-22 13:06:49 -08:00
Andrew ClarkandGitHub 2081a0053a Merge pull request #8949 from acdlite/fibercomponentlifecycletests
[Fiber] Component lifecycle tests
2017-02-22 12:54:42 -08:00
Brian VaughnandBrian Vaughn a44a5d68d8 Fix bugs that occur when event responder unmounts during a touch event sequence
> This PR adds a test (initially failing) for this case along with a fix for stack and fiber. The stack fix was copied from a Diff submitted by @sema. The fiber fix just required us to stop leaking properties for unmounted views.
> Longer term we may want to explicitly invoke a release event listener for a responder just before unmounting it. This PR does not do that.
2017-02-22 12:47:34 -08:00
Andrew ClarkandGitHub 42c375b136 Merge pull request #9040 from acdlite/assignstateincwrp
Support for assigning to this.state inside componentWillReceiveProps
2017-02-22 12:45:58 -08:00