Commit Graph

243 Commits

Author SHA1 Message Date
Christopher Chedeau
c8cd133116 Add es6-promisify 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
c88cb03b96 [rrm] Rewrite stable-prs command
Now with
- better UX (can skip, handle each failed cherr-pick individually)
- easier to read code
- better error handling / cancellation
2017-01-06 13:47:16 +00:00
Paul O’Shannessy
a52e000356 [rrm] Use git helper for all git commands 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
e14746e05e [rrm] Create start-release command, create git utils
This does the essentials for starting a new release on the stable branch
2017-01-06 13:47:16 +00:00
Paul O’Shannessy
742c33f6f4 [rrm] Update init command to use Promise style 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
8c94467aad [rrm] Improve init & config loading experience 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
114bafb6f0 [rrm] Update to account for new react-test-renderer package 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
27d6137dfd [rrm] Add commands for npm access checking/granting 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
a104ad2ec2 [rrm] Lint 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
bcd1773feb [rrm] npm-publish command
This will publish all packages in build/packages/*.tgz to the "next" tag. If the current version is "stable" (doesn't trigger semver.prerelease()) then it will also update the "latest" dist-tag to point at that version.
2017-01-06 13:47:16 +00:00
Paul O’Shannessy
a68ca21469 [rrm] Add logging to execInRepo, dry-run option 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
a9035c1e4e [rrm] stable-prs: update milestone on PRs 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
bbf6079ca3 [rrm] Move version reading up to app level 2017-01-06 13:47:16 +00:00
Paul O’Shannessy
6938157c76 Initial import of react-release-manager 2017-01-06 13:47:16 +00:00
Brandon Dail
8095ebaae7 [Fiber] Throw when attempting to unmount at an invalid node (#8688)
* Throw when attempting to unmount at an invalid node

* Remove extra character after invariant
2017-01-05 16:55:17 -08:00
Dan Abramov
ca2c71c0c5 Fix AMD and Brunch issues (#8686)
* Add manual build fixtures

* Inject ReactDOM into ReactWithAddons from ReactWithAddons

We used to read ReactDOM as a global inside ReactAddonsDOMDependenciesUMDShim.
This didn't work in AMD environments such as RequireJS and SystemJS.

Instead, I changed it so that ReactDOM gets injected into ReactWithAddons by ReactDOM itself.
This way we don't have to try to require it (which wouldn't work because AMD doesn't handle circular dependencies well).

This means you have to load ReactDOM first before using ReactDOM-dependent addons, but this was already the case before.

This commit makes all build fixtures pass.

* Memoize ReactDOM to avoid going into require on every access

* Add Brunch fixture

* Inline requires to work around Brunch bug

See #8556 and https://github.com/brunch/brunch/issues/1591#issuecomment-270742503 for context.
This appears to be a Brunch bug but we can keep a temporary fix until the next major.
2017-01-05 13:16:08 -08:00
Andrew Clark
2517a11875 Update refs even if shouldComponentUpdate returns false
Implemented using a Ref effect type.
2017-01-04 12:05:25 -08:00
Brian Vaughn
b27cb2ca2b Merge pull request #8677 from bvaughn/add-callback-validation-to-dom-render
Add callback validation to fiber-based renderers
2017-01-03 14:57:42 -08:00
Brian Vaughn
8fbcd499bd Add callback validation to fiber-based renderers
Moved ReactFiberClassComponent validateCallback() helper function into a standalone util used by both fiber and stack implementations. Validation now happens in ReactFiberUpdateQueue so that non-DOM renderers will also benefit from it.
2017-01-03 12:10:06 -08:00
Andrew Clark
47f92b940f Merge pull request #8658 from acdlite/nullupdatetest
Should not re-render as the result of a null state update
2017-01-03 10:27:32 -08:00
Andrew Clark
ad7bcdf999 Use unbatchedUpdates to opt-out of batching
Reverses the effect of batchedUpdates by resetting the current
batching context.

Does not affect nested updates, which are always deferred regardless
of whether they are inside a batch.
2017-01-03 10:24:27 -08:00
Andrew Clark
b79531eefe No nested updates
We may decide to provide this ability as an escape hatch in the future.
2016-12-30 11:30:40 -08:00
Andrew Clark
5c927b902f Should not re-render as the result of a null state update
Fiber already happens to behave this way; this just adds a test.

TODO: Should we add this feature to Stack, too?
2016-12-29 23:31:48 -08:00
Andrew Clark
79f01b2425 prepareForCommit returns info object to be passed resetAfterCommit
The DOM renderer assumes that resetAfterCommit is called after
prepareForCommit without any nested commits in between. That may not
be the case now that syncUpdates forces a nested update.

To address, this changes the type of prepareForCommit to return a value
which is later passed to resetAfterCommit.
2016-12-29 10:39:24 -08:00
Brian Vaughn
df6ca0e2c1 Merge pull request #8646 from bvaughn/focus-side-effect
Renderers can queue commit effects for initial mount
2016-12-28 15:16:50 -05:00
Brian Vaughn
a10131304b Renderers can schedule commit-time effects for initial mount
The finalizeInitialChildren HostConfig method now utilizes a boolean return type. Renderers can return true to indicate that custom effects should be processed at commit-time once host components have been mounted. This type of work is marked using the existing Update flag.

A new HostConfig method, commitMount, has been added as well for performing this type of work.

This change set is in support of the autoFocus prop.
2016-12-28 15:03:08 -05:00
Dan Abramov
6b73073557 Include owner in invalid element type invariant (#8637) 2016-12-27 08:41:23 -08:00
Dan Abramov
38ed61f4c4 Relax test about rendering top-level null (#8640) 2016-12-27 08:38:24 -08:00
Dan Abramov
119294dcae Validate that update callback is a function (#8639) 2016-12-27 08:38:10 -08:00
Ben Alpert
13980e6536 Fiber: Fix reentrant mounting in synchronous mode (#8623) 2016-12-22 11:34:35 -08:00
Dan Abramov
c978f789cc [Fiber] Push class context providers even if they crash (#8627)
* Push class context providers early

Previously we used to push them only after the instance was available. This caused issues in cases an error is thrown during componentWillMount().

In that case we never got to pushing the provider in the begin phase, but in complete phase the provider check returned true since the instance existed by that point. As a result we got mismatching context pops.

We solve the issue by making the context check independent of whether the instance actually exists. Instead we're checking the type itself.

This lets us push class context early. However there's another problem: we might not know the context value. If the instance is not yet created, we can't call getChildContext on it.

To fix this, we are introducing a way to replace current value on the stack, and a way to read the previous value. This also helps remove some branching and split the memoized from invalidated code paths.

* Add a now-passing test from #8604

Also rename another test to have a shorter name.

* Move isContextProvider() checks into push() and pop()

All uses of push() and pop() are guarded by it anyway.

This makes it more similar to how we use host context.

There is only one other place where isContextProvider() is used and that's legacy code needed for renderSubtree().

* Clarify why we read the previous context

* Use invariant instead of throwing an error

* Fix off-by-one in ReactFiberStack

* Manually keep track of the last parent context

The previous algorithm was flawed and worked by accident, as shown by the failing tests after an off-by-one was fixed.

The implementation of getPrevious() was incorrect because the context stack currently has no notion of a previous value per cursor.

Instead, we are caching the previous value directly in the ReactFiberContext in a local variable.

Additionally, we are using push() and pop() instead of adding a new replace() method.
2016-12-22 10:36:42 -08:00
Brian Vaughn
b209804cfb Jest preprocessor better aware of error-codes/codes.json WRT caching 2016-12-21 16:58:33 -08:00
Dan Abramov
a27e4f3361 [Fiber] Make requestIdleCallback() and requestAnimationFrame() shims async (#8591)
* Add a failing test for recursion check

* Make requestIdleCallback() and requestAnimationFrame() shims async

They no longer need to be sync in tests because we already made DOM renderer sync by default.
This fixes a crash when testing incrementalness in DOM renderer itself.

* Style fix

* Fix lint
2016-12-21 14:04:05 -08:00
Ben Alpert
2a5fe4c2b0 Call refs and lifecycles on indeterminate components (#8614)
This was a bug because of the split between ClassComponent and IndeterminateComponent -- we didn't mark effects or push context when we come from an indeterminate component. Now they behave the same way.

The code is even clumsier than before but I'm pretty worried we'll screw these up in the future if we don't unify the paths.

Not many components exercise this path but Relay containers do so it's noticeable.
2016-12-21 13:51:59 -08:00
Ben Alpert
eca5b1d48e Improve error messages for invalid element types (#8612) 2016-12-21 13:17:34 -08:00
Andrew Clark
15acbaa8e1 Handle errors thrown when committing root
Previously this caused an infinite loop.
2016-12-20 16:20:57 -08:00
Andrew Clark
470da6ea77 Add test for errors in host config while working on failed root
Test for a bug fixed in the previous commit that was causing an
infinite loop.
2016-12-19 18:46:13 -08:00
Andrew Clark
6c26e98ec2 Handle case where host environment throws when working on failed root
Otherwise you fall into an infinite loop where root fails -> host env
throws -> root fails...

This is a worst-case scenario that should only be possible if there's
a bug in the renderer.
2016-12-19 18:06:56 -08:00
Andrew Clark
da4ace152b Remove unmountContainer
Instead, renderers should pass null to updateContainer.
2016-12-19 16:33:25 -08:00
Andrew Clark
c6ccc19095 Use an UpdateQueue for top-level updates
...rather than mutate the pendingProps directly, which throws away any
previously scheduled work.
2016-12-19 16:33:16 -08:00
Andrew Clark
0b37588171 Revert "[Fiber] Queue top-level updates" 2016-12-19 15:32:59 -08:00
Andrew Clark
ddc44b7add Merge pull request #8584 from acdlite/fiberhostrootupdatequeue
[Fiber] Queue top-level updates
2016-12-19 13:56:18 -08:00
Brian Vaughn
1b868cbd71 Don't warn about class component usage of getInitialState if state is also set
We warn about getInitialState() usage in class components because users may have accidentally used it instead of state. If they have also specified state though then we should skip this warning.

Context: https://twitter.com/soprano/status/810003963286163456
2016-12-17 11:16:27 -08:00
Brian Vaughn
a5e728747e Merge pull request #8590 from bvaughn/unexpected-context-pop
`bailoutOnLowPriority` pushes context to mirror complete phase context pop
2016-12-17 07:41:25 -08:00
Dan Abramov
70f704dca6 [Fiber] Nesting validation warnings (#8586)
* (WIP) Nesting warnings

* Remove indirection

* Add a note about namespace

* Fix Flow and make host context required

This makes it easier to avoid accidental nulls.
I also added a test for the production case to avoid regressing because of __DEV__ branches.
2016-12-16 18:57:58 -08:00
Andrew Clark
a9365b97e5 Remove unmountContainer
Instead, renderers should pass null to updateContainer.
2016-12-16 18:31:39 -08:00
Andrew Clark
d8ade83eb2 Use an UpdateQueue for top-level updates
...rather than mutate the pendingProps directly, which throws away any
previously scheduled work.
2016-12-16 16:30:28 -08:00
Andrew Clark
7b6c94c767 Don't drop updates from queue when calling replaceState
We should be able to support passing a function to replaceState, which
receives the accumulation of all the previously applied state updates.
Which means we shouldn't drop those updates from the queue. Technically,
we could drop them only when an object is passed to replaceState, but
that seems like more trouble than it's worth.
2016-12-16 16:20:16 -08:00
Brian Vaughn
441cc5c82b bailoutOnLowPriority correct pushes context for ClassComponents to mirror complete phase context pop 2016-12-16 15:04:06 -08:00
Andrew Clark
eec431297a Priority context during reconciliation
setState inside render/cWRP should have the same priority as whatever
level is currently being reconciled.
2016-12-15 09:12:13 -08:00