Commit Graph

9206 Commits

Author SHA1 Message Date
Dan Abramov
0e5767824f Don't mark portals for updates (#11255) 2017-10-17 20:53:15 +01:00
Dustan Kasten
94e8e9d88e isPortal() is not referenced anywhere (#11256) 2017-10-17 20:27:54 +01:00
Dan Abramov
56e5288b04 Remove broken links from React ART readme 2017-10-17 14:20:48 +01:00
Dan Abramov
1ef250d881 Move Flow environment into scripts/flow (#11249)
* Move flow environment into scripts/flow

* Run Prettier
2017-10-17 14:20:00 +01:00
Dan Abramov
979fce8b72 Delete adler32 implementation (#11250) 2017-10-17 14:19:47 +01:00
Dan Abramov
5be6a1a6d1 Drop name and commonerConfig from package.json (#11244) 2017-10-17 13:34:01 +01:00
Dan Abramov
043d369210 Simplify Jest-specific tests (#11243)
* Delete tests that only mattered during createElement transition

They were added after #2576, but were only important when React.createElement was introduced as a migration path.
Now that elements are used consistently, these tests shouldn't be necessary.

I created a separate test specifically for scryRenderedComponentsWithType() though because that was the only one.

* Simplify mocking test setup

Today, the only remaining special behavior for Jest mocks is we let them render undefined.

We don't plan to introduce any other special behavior for them in the future.
(In fact, we already decided against replicating this special behavior for functional components.)

Therefore, we can remove dependency on Jest automocking mechanism in these tests completely,
and just explicitly mock the render method which is the only one for which we have special behavior.

For clarity, we add an explicit test for mockComponent() API (whose naming is a bit of a lie).
2017-10-17 13:05:44 +01:00
Dan Abramov
49d4381c67 Simplify Jest config a little bit (#11242)
* Inline getTestDocument into test cases

* Remove mention of mock file we do not use

* Remove unused configuration entries

* Move eslint-rules package into the scripts/ folder
2017-10-16 23:17:00 +01:00
Brian Vaughn
9ed78ad277 Tweaked wording of release script README 2017-10-16 15:02:41 -07:00
Brian Vaughn
c371c152ab Release script (#11223)
* First chunk of new release script

* Re-ordered build steps to combine error codes and releases

* Reorganized build files; added stub publish script

* First pass at publis script. Also collect and print dry-run commits/publish commands.

* Deleted old react-release-manager scripts

* Cleaned up release package.json

* Basic README instructions

* Removed unnecessary 'async' keyword from a method

* Wordsmithing

* Tweaked README

* Renamed build -> build-commands and publish -> publish-commands to avoid conflict with .gitignore

* Bump pre-release package versions differently

* Prettier

* Improved CircleCI API token setup instructions message

* Lint fix

* Typofix
2017-10-16 15:01:14 -07:00
Dan Abramov
b5a2a1349d Bump Jest version (#11241) 2017-10-16 21:38:34 +01:00
Dan Abramov
f8134966c9 Record sizes 2017-10-16 20:51:36 +01:00
Clark Du
b623bf43a0 Use value on <select> instead of setting selected on <option> (#11206) 2017-10-16 07:46:24 -04:00
Fatos Morina
17de6a35cf Fix typos (#11204)
* Use an MVP rather than a MVP

* Use the capital letter for React and highlight eslint-plugin

* Fix typos
2017-10-14 16:26:10 -04:00
Andrew Clark
7687962249 ReactDOM.createRoot (#11225)
* ReactDOM.createRoot

Introduce new API for creating roots. Only root.render and root.unmount
are implemented. Later we'll add root.prerender, and support for lazy
roots (roots with DOM containers that resolve lazily).

* Add hydrate option to createRoot
2017-10-13 20:08:36 -07:00
Andrew Clark
3ffb5d0876 Deterministic updates (#10715)
* Deterministic updates

High priority updates typically require less work to render than
low priority ones. It's beneficial to flush those first, in their own
batch, before working on more expensive low priority ones. We do this
even if a high priority is scheduled after a low priority one.

However, we don't want this reordering of updates to affect the terminal
state. State should be deterministic: once all work has been flushed,
the final state should be the same regardless of how they were
scheduled.

To get both properties, we store updates on the queue in insertion
order instead of priority order (always append). Then, when processing
the queue, we skip over updates with insufficient priority. Instead of
removing updates from the queue right after processing them, we only
remove them if there are no unprocessed updates before it in the list.

This means that updates may be processed more than once.

As a bonus, the new implementation is simpler and requires less code.

* Fix ceiling function

Mixed up the operators.

* Remove addUpdate, addReplaceState, et al

These functions don't really do anything. Simpler to use a single
insertUpdateIntoFiber function.

Also splits scheduleUpdate into two functions:

- scheduleWork traverses a fiber's ancestor path and updates their
  expiration times.
- scheduleUpdate inserts an update into a fiber's update queue, then
  calls scheduleWork.

* Remove getExpirationTime

The last remaining use for getExpirationTime was for top-level async
updates. I moved that check to scheduleUpdate instead.

* Move UpdateQueue insertions back to class module

Moves UpdateQueue related functions out of the scheduler and back into
the class component module. It's a bit awkward that now we need to pass
around createUpdateExpirationForFiber, too. But we can still do without
addUpdate, replaceUpdate, et al.

* Store callbacks as an array of Updates

Simpler this way.

Also moves commitCallbacks back to UpdateQueue module.

* beginUpdateQueue -> processUpdateQueue

* Updates should never have an expiration of NoWork

* Rename expiration related functions

* Fix update queue Flow types

Gets rid of an unneccessary null check
2017-10-13 17:21:25 -07:00
Sebastian Markbåge
36a2afccc5 [CS] Split Host Config Out into a Mutable or Immutable Mode (#11213)
* CS renderer

Because we didn't have enough RN experiments. I want to add one more.

* Split out hydration from the host config object

This makes it easier to do feature detection on the configuration.

* Move mutation host config to separate optional object

* Refs and life-cycles should happen even in immutable mode

* Unmount components even in non-mutation mode

This is the same as committing deletions but instead of finding host
components to delete, it only invokes componentWillUnmount and detaching
of refs.

* Add persistent updates API

This mode will use a clone based API instead of mutating host instances.

Needs implementation still.

It's awkward that there can be more than one child inserted into the root.
So we need a new API to create a "root" instance so that we can update it
atomically. Alternatively we could keep the mutable API for containers
and assume that most use cases would only have a single root.

* Package up CS renderer

* Fix reconciler package fixture
2017-10-13 14:29:59 -07:00
Andrew Clark
339d6cb32b Sync setStates inside willUpdate and didUpdate should flush at same time (#11212)
In sync mode, we downgrade sync priority work to task work when we're in
the commit phase, but not in the render phase. That means if you
schedule updates in both phases, the render phase update will flush
first, and the commit phase update will flush after that. What should
really happen is that both updates flush at the same time.

To solve this, updates in the commit phase are now given sync priority.
The distinction between task and sync really only exists to account for
a historical quirk in the behavior of top-level mounts. (Refer to the
test case titled "initial mount is sync inside batchedUpdates".)

Ideally, there would only be one priority for both sync and task. This
gets us closer to that model, while still accounting for
top-level mounts.
2017-10-12 21:05:58 -07:00
Haroen Viaene
0c5a455ecb chore(syntheticEvent): remove IE8 code (#11178)
* chore(syntheticEvent): remove IE8 code

Since IE8 has been deprecated for a while, I thought it might be useful to remove some IE8-only code

If this is not something you want to focus on yet, or is too much work to test, feel free to close this PR

* Update SyntheticUIEvent.js

* Update SyntheticUIEvent.js

* remove unused require

* completely remove UIEvent

* augment with noop

everything breaks otherwise

* comment back

* spacing
2017-10-12 17:30:47 -04:00
Nathan Hunzaker
19043236be Add exception for 16.alpha when loading React in DOM Fixtures (#11200)
The file structure was updated in 16. This wasn't the case for
alphas. We need to load the old module location for anything less than
16 RC.
2017-10-12 17:30:03 -04:00
Andrew Clark
8ac9600574 Remove priority coalescing and PriorityLevel module (#11187)
Coalescing is the only feature that depends on PriorityLevel. Since
we're not sure if coalescing is even valuable, we'll remove it for
now. If it turns out we need it, we can add it back later.
2017-10-11 14:48:44 -07:00
Dustan Kasten
111731dedd React reconciler package (#10758)
* Initial commit of react-reconciler bundle

* I think it’s working 🙀

* React reconciler: slightly better description and README

* Drop react-reconciler version to an unstable release number

* Convert to moduleType enum and fix packaging

* eslint

* s/Renderer/Reconciler in docs

* yarn prettier

* change names of things in the react-reconciler readme

* change predicate

* rollup: flip object-assign shimming check

* copy noop renderer into react-reconciler fixture

* Change reconciler fixture test

* prettier

* Remove a bunch of Noop test renderer

* Delete a bunch of stuff we don’t care about for reconciler teesting. Add flow pragmas for future flow pragma testing

* Remove PATENTS

* Update Reconciler fixture docs

* ReactDOMUnstableNativeDependencies should be ISOMORPHIC

* Inline fixture renderer

* Make it "RENDERER"

* There is no UMD build. It also doesn't need propTypes.

* Tweak how the reconciler is built

* Record sizes

* Update README.md
2017-10-11 19:29:26 +01:00
Dan Abramov
fb0199b73c Add to changelog 2017-10-11 19:08:25 +01:00
Dan Abramov
6c592deac9 Record sizes 2017-10-11 19:06:43 +01:00
Dan Abramov
2228f497f3 Keep autoFocus attribute in the DOM (#11192)
* Keep autoFocus attribute in the DOM

* Don't emit autoFocus attribute on the client

* Test that hydration doesn't call focus

* Add autoFocus to SSR fixture
2017-10-11 18:52:12 +01:00
Dan Abramov
b75be6a363 Move loop init variable assignment (#11182) 2017-10-11 11:46:15 +01:00
Dan Abramov
4a26b90cfa Fix DOM fixture for 16.0.0 2017-10-11 10:50:00 +01:00
Brian Vaughn
8b3ad851fd Update build scripts to put RN-RT files in the right places (#11183) 2017-10-10 13:44:43 -07:00
Dan Abramov
e5db5302ac Fix false positive <noscript> rehydration text difference warning in React 16 (#11157)
* Add <noscript> with HTML in it to SSR fixture

* Wrap <noscript> into a <div> to get its "client HTML"

* Revert "Wrap <noscript> into a <div> to get its "client HTML""

This reverts commit 27a42503e2.

* Always use parent.ownerDocument
2017-10-10 19:35:43 +01:00
Dan Abramov
f42dfcdb94 Fix false positive SVG hydration warning for mixed case tags (#11174)
* Add a failing test for <feMorphology> SSR

It causes a false positive warning on hydration.

* Make hydration tag comparison case insensitive
2017-10-10 19:34:37 +01:00
Dan Abramov
18f408fb6b Update changelog 2017-10-10 17:57:45 +01:00
Dan Abramov
309fa6c871 Don't set empty placeholder to work around IE11 bug (#11177)
* Don't set empty placeholder to work around IE11 bug

* Add fixture for textarea placeholders
2017-10-10 17:49:59 +01:00
Dan Abramov
10320a5331 Update changelog 2017-10-10 16:58:19 +01:00
Dustan Kasten
9b4e4e1759 Fix obscure error message when passing an invalid style value for SSR (#11173)
* Add failing iframe test

* Possible fix by returning null ownerName in SSR

* prettier

* eslolint

* gah c’mon really?

* emptyFunction.thatReturnsNull

* One less property access
2017-10-10 16:57:25 +01:00
Shirshak Bajgain
45c05c7097 Remove broken link from licence (#11176) 2017-10-10 16:57:00 +01:00
Dan Abramov
09cafa6e40 Changelog 2017-10-10 16:56:42 +01:00
Brandon Dail
5c6cb597f9 Fix form reset for uncontrolled select elements (#11057)
* Set defaultSelected on option element from select's defaultValue

* Add form reset fixture for selects

* Pass explicit value for setDefaultSelected
2017-10-10 16:54:59 +01:00
Dan Abramov
b2101cb328 Record sizes 2017-10-10 16:06:05 +01:00
Dan Abramov
20471d693d Update changelog 2017-10-10 12:35:24 +01:00
Filipp Riabchun
2264e3d044 Shallow renderer: support multiple setState invocation (#11167) 2017-10-10 12:33:57 +01:00
Dan Abramov
44c795c45f Update rolling changelog 2017-10-10 11:59:29 +01:00
Ori Riner
6ad6dcd112 Clear previous children when SVG node doesn't have innerHTML (#11108)
* clear previous children when SVG node doesn't have innerHTML

* remove 'get' handler for appendChild in test node proxy
2017-10-10 11:54:47 +01:00
Andrew Clark
3019210df2 Expiration times (#10426)
* [Work-in-progress] Assign expiration times to updates

An expiration time represents a time in the future by which an update
should flush. The priority of the update is related to the difference
between the current clock time and the expiration time. This has the
effect of increasing the priority of updates as time progresses, to
prevent starvation.

This lays the initial groundwork for expiration times without changing
any behavior. Future commits will replace work priority with
expiration times.

* Replace pendingWorkPriority with expiration times

Instead of a priority, a fiber has an expiration time that represents
a point in the future by which it should render.

Pending updates still have priorities so that they can be coalesced.

We use a host config method to read the current time. This commit
implements everything except that method, which currently returns a
constant value. So this just proves that expiration times work the same
as priorities when time is frozen. Subsequent commits will show the
effect of advancing time.

* Triangle Demo should use a class

shouldComponentUpdate was removed from functional components.

Running the demo shows, now that expiration is enabled, the demo does
not starve. (Still won't run smoothly until we add back the ability to
resume interrupted work.)

* Use a magic value for task expiration time

There are a few cases related to sync mode where we need to distinguish
between work that is scheduled as task and work that is treated like
task because it expires. For example, batchedUpdates. We don't want to
perform any work until the end of the batch, regardless of how much
time has elapsed.

* Use current time to calculate expiration time

* Add unit tests for expiration and coalescing

* Delete unnecessary abstraction

* Move performance.now polyfill to ReactDOMFrameScheduling

* Add expiration to fuzz tester

* Expiration nits

- Rename Done -> NoWork
- Use max int32 instead of max safe int
- Use bitwise operations instead of Math functions
2017-10-09 18:39:53 -07:00
Georgios Giannoutsos Barkas
65b16b1c7e Allow custom attribute named on to be passed on to elements (#11153)
* Allow single `on` property for custom elements

* Remove test from ReactDOMComponent-test

* Allow custom attribute named 'on' to be passed

* Check property length instead of comparing strings
2017-10-09 17:31:24 -07:00
Dan Abramov
80596c2c92 Fix incorrect calculation of onMouseEnter/Leave component path (#11164)
* Add a regression test for #10906

* Turn while conditions into breaks without changing the logic

This will be easier to follow when we add more code there.

* var => const/let

So that I can add a block scoped variable.

* Check alternates when comparing to the common ancestor

This is the actual bugfix.
2017-10-09 20:30:03 +01:00
Dustan Kasten
08cbc257bd Bump peer deps of react to ^16.0.0 (#11156) 2017-10-09 16:00:50 +01:00
Sebastian Markbåge
4131af3e4b Ignore SSR warning using explicit suppressHydrationWarning option (#11126)
* Pass parent type and props to insert/delete hydration warning hooks

For this to work, we need to split the API into a container and normal
version. Since the root doesn't have a type nor props.

* Ignore SSR warning using explicit suppressHydrationWarning option

This lets you ignore the warning on a single element and its direct child
content. This is useful for simple fields that you're expecting to fail
such as time stamps.

Note that this still won't patch up such content so it'll remain
inconsistent. It's also not suitable for nested complex content that may
change.

* Suppress warning of inserted/deleted direct children

* Add fixture testing hydration warning

Also fixing the render->hydrate API change in the fixture

* Add hooks when text hydration doesn't match up

The purpose of these hooks is to pass the parent context to them. I don't
want to do that in the normal hydrateTextInstance hooks since this is
only used in DEV. This is also in line with what happens if there is no
text instance at all and we invoke didNotFindHydratableTextInstance.

* Move mismatch text hydration warning to the new hooks

This lets us ignore this call when we have parent props available and
the suppression flag is set.
2017-10-06 19:50:01 -07:00
Sebastian Markbåge
5744571140 [RT] More predictable things (#11139)
* Inject the right event emitter

Previously this was injecting the ReactNativeEventEmitter even though
we want the ReactNativeRTEventEmitter.

RCTEventEmitter is also just an abstraction around BatchedBridge that
registers a single name. We can't register more than one with it. Removed
that abstraction for now so we don't have to add it back into the RN repo.

* Unify appendChildToDetachedParent and appendChild, separate root

Merge appendChildToDetachedParent and appendChild. We don't need the distinction.

We do however need a separate notion for the root container.
Calling this `appendChildToContext` since Context has a meaning here.

* Add a simple shallow comparison so that we don't send updates for equal props

This still sends all props if any differs. Not sure we'll want that but I
think so.

* Add BatchedBridge to bundle externals

* Lint
2017-10-06 19:08:22 -07:00
Dan Abramov
190a1141cc Add an item to changelog 2017-10-06 23:08:25 +01:00
Anushree Subramani
e8629667ab Deduplication of warning messages in nested updates (#11081) (#11113) 2017-10-06 23:04:18 +01:00