Commit Graph

1347 Commits

Author SHA1 Message Date
Dan Abramov
6948842cf8 Remove CI check 2020-10-14 19:40:30 +01:00
Dan Abramov
037717685a Check in old major packages 2020-10-14 18:43:29 +01:00
Dan Abramov
6d50a9d090
Fixture: Legacy JSX Runtimes (#20012)
* Fixture: Legacy JSX Runtimes

* Add more comments
2020-10-14 18:28:03 +01:00
Ricky
880587366d
Deprecate old test script commands (#19893)
* Deprecate old test script commands

* Update PR template test script

* Add test-stable and test-www-classic

* Update circle test names

* Rename test-www-classic to test-classic

* Missed some job renames

* Missed some more job renames
2020-10-14 08:54:34 -04:00
Nick Reiley
7e405d458d
[DevTools] Add DevTools forked Feature flags (#18994)
Also resolve an uncaught error in extension build (#18843).

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-10-12 13:07:10 -04:00
Sebastian Markbåge
0a4c7c5651
[Flight] Don't warn for key, but error for ref (#19986)
* Improve error message by expanding the object in question

* Don't warn for key/ref getters

* Error if refs are passed in server components or to client components
2020-10-08 17:02:23 -07:00
Sebastian Markbåge
40c52de960
[Flight] Add Runtime Errors for Non-serializable Values (#19980)
* Error on encoding non-serializable props

* Add DEV time warnings to enforce that values are plain objects
2020-10-08 11:11:15 -07:00
Dan Abramov
c91c1c4ebe Release script: allow preparing RC from npm 2020-09-22 14:27:50 +01:00
Andrew Clark
e7b255341b
Internal act: Flush timers at end of scope (#19788)
If there are any suspended fallbacks at the end of the `act` scope,
force them to display by running the pending timers (i.e. `setTimeout`).

The public implementation of `act` achieves the same behavior with an
extra check in the work loop (`shouldForceFlushFallbacks`). Since our
internal `act` needs to work in both development and production, without
additional runtime checks, we instead rely on Jest's mock timers.

This doesn't not affect refresh transitions, which are meant to delay
indefinitely, because in that case we exit the work loop without
posting a timer.
2020-09-08 21:55:23 -07:00
Andrew Clark
1665443603
Rename effect fields (#19755)
- `effectTag` -> `flags`
- `subtreeTag` -> `subtreeFlags`
2020-09-04 14:34:07 -07:00
Pascal Fong Kye
1396e4a8f5
Fixes eslint warning when node type is ChainExpression (#19680)
* Add babel parser which supports ChainExpression

* Add and fix tests for new babel eslint parser

* extract function to mark node

* refactor for compatibility with eslint v7.7.0+

* Update eslint to v7.7.0
Update hook test since eslint now supports nullish coalescing
2020-08-29 21:03:23 +01:00
Dan Abramov
c1ac052158
[Flight] Support more element types and Hooks for Server and Hybrid Components (#19711)
* Shim support for more element types

* Shim commonly used Hooks that are safe

* Flow

* Oopsie
2020-08-27 20:19:13 +01:00
Andrew Clark
8da0da0937
Disable timeoutMs argument (#19703)
* Remove distinction between long, short transitions

We're removing the `timeoutMs` option, so there's no longer any
distinction between "short" and "long" transitions. They're all treated
the same.

This commit doesn't remove `timeoutMs` yet, only combines the internal
priority levels.

* Disable `timeoutMs` argument

tl;dr
-----

- We're removing the `timeoutMs` argument from `useTransition`.
- Transitions will either immediately switch to a skeleton/placeholder
  view (when loading new content) or wait indefinitely until the data
  resolves (when refreshing stale content).
- This commit disables the `timeoutMS` so that the API has the desired
  semantics. It doesn't yet update the types or migrate all the test
  callers. I'll do those steps in follow-up PRs.

Motivation
----------

Currently, transitions initiated by `startTransition` / `useTransition`
accept a `timeoutMs` option. You can use this to control the maximum
amount of time that a transition is allowed to delay before we give up
and show a placeholder.

What we've discovered is that, in practice, every transition falls into
one of two categories: a **load** or a **refresh**:

- **Loading a new screen**: show the next screen as soon as possible,
  even if the data hasn't finished loading. Use a skeleton/placeholder
  UI to show progress.
- **Refreshing a screen that's already visible**: keep showing the
  current screen indefinitely, for as long as it takes to load the fresh
  data, even if the current data is stale. Use a pending state (and
  maybe a busy indicator) to show progress.

In other words, transitions should either *delay indefinitely* (for a
refresh) or they should show a placeholder *instantly* (for a load).
There's not much use for transitions that are delayed for a
small-but-noticeable amount of time.

So, the plan is to remove the `timeoutMs` option. Instead, we'll assign
an effective timeout of `0` for loads, and `Infinity` for refreshes.

The mechanism for distinguishing a load from a refresh already exists in
the current model. If a component suspends, and the nearest Suspense
boundary hasn't already mounted, we treat that as a load, because
there's nothing on the screen. However, if the nearest boundary is
mounted, we treat that as a refresh, since it's already showing content.

If you need to fix a transition to be treated as a load instead of a
refresh, or vice versa, the solution will involve rearranging the
location of your Suspense boundaries. It may also involve adding a key.

We're still working on proper documentation for these patterns. In the
meantime, please reach out to us if you run into problems that you're
unsure how to fix.

We will remove `timeoutMs` from `useDeferredValue`, too, and apply the
same load versus refresh semantics to the update that spawns the
deferred value.

Note that there are other types of delays that are not related to
transitions; for example, we will still throttle the appearance of
nested placeholders (we refer to this as the placeholder "train model"),
and we may still apply a Just Noticeable Difference heuristic (JND) in
some cases. These aren't going anywhere. (Well, the JND heuristic might
but for different reasons than those discussed above.)
2020-08-26 14:35:13 -07:00
Andrew Clark
af219cc6e6
Lint rule to forbid access of cross-fork fields (#19679)
* Lint rule to forbid access of cross-fork fields

We use a shared Fiber type for both reconciler forks (old and new). It
is a superset of all the fields used by both forks. However, there are
some fields that should only be used in the new fork, and others that
should only be used in the old fork.

Ideally we would enforce this with separate Flow types for each fork.
The problem is that the Fiber type is accessed by some packages outside
the reconciler (like React DOM), and get passed into the reconciler as
arguments. So there's no way to fork the Fiber type without also forking
the packages where they are used. FiberRoot has the same issue.

Instead, I've added a lint rule that forbids cross-fork access of
fork-specific fields. Fields that end in `_old` or `_new` are forbidden
from being used inside the new or old fork respectively. Or you can
specific custom fields using the ESLint plugin options.

I used this plugin to find and remove references to the effect list
in d2e914a.

* Mark effect list fields as old

And `subtreeTag` as new.

I didn't mark `lastEffect` because that name is also used by the
Hook type. Not super important; could rename to `lastEffect_old` but
idk if it's worth the effort.
2020-08-24 10:07:11 -07:00
Dan Abramov
848bb2426e
Attach Listeners Eagerly to Roots and Portal Containers (#19659)
* Failing test for #19608

* Attach Listeners Eagerly to Roots and Portal Containers

* Forbid createEventHandle with custom events

We can't support this without adding more complexity. It's not clear that this is even desirable, as none of our existing use cases need custom events. This API primarily exists as a deprecation strategy for Flare, so I don't think it is important to expand its support beyond what Flare replacement code currently needs. We can later revisit it with a better understanding of the eager/lazy tradeoff but for now let's remove the inconsistency.

* Reduce risk by changing condition only under the flag

Co-authored-by: koba04 <koba0004@gmail.com>
2020-08-24 16:50:20 +01:00
Julien Gilli
b8fa09e9e2
provide profiling bundle for react-reconciler (#19559) 2020-08-19 14:11:27 +01:00
Timothy Yung
1a41a196bc
Append text string to <Text> error message (#19581)
* Append text string to <Text> error message

* Truncate text in <Text> error message

* Regenerate `codes.json`
2020-08-17 10:47:49 -07:00
CY Lim
702fad4b1b
refactor fb.me redirect link to reactjs.org/link (#19598)
* refactor fb.me url to reactjs.org/link

* Update ESLintRuleExhaustiveDeps-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

* Update createReactClassIntegration-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-08-17 13:25:50 +01:00
Toru Kobayashi
49cd77d24a
fix: leak strict mode with UMD builds (#19614) 2020-08-15 14:42:49 +01:00
Andrew Clark
b8ed6a1aa5
[Scheduler] Call postTask directly (#19551)
This updates the experimental Scheduler postTask build to call postTask
directly, instead of managing our own custom queue and work loop.

We still use a deadline 5ms mechanism to implement `shouldYield`.

The main thing that postTask is currently missing is the continuation
feature — when yielding to the main thread, the yielding task is sent
to the back of the queue, instead of maintaining its position.

While this would be nice to have, even without it, postTask may be good
enough to replace our userspace implementation.

We'll run some tests to see.
2020-08-12 08:39:47 -05:00
Andrew Clark
0cd9a6de55
Parallelize Jest in CI (#19552)
Uses CircleCI's `parallelism` key to split our test jobs across multiple
processes, like we do for the build job.
2020-08-07 16:32:59 -04:00
Dan Abramov
2d9ec9199c Indent a command 2020-08-07 19:24:49 +01:00
Dan Abramov
db2f229110 Fix command 2020-08-07 19:23:43 +01:00
Dominic Gannaway
b61174fb7b
Remove the deprecated React Flare event system (#19520) 2020-08-05 15:13:29 +01:00
Halit Ogunc
8d57ca519a
fix: typo in React Release Scripts (#19524) 2020-08-04 13:22:50 -04:00
Ricky
a437f3ff30
Use RN fork in default branch of feature flags (#19522) 2020-08-03 17:40:58 -04:00
Ricky
86314d5b45
Turn off new component stacks for React Native (#19521) 2020-08-03 14:45:50 -04:00
Dan Abramov
a1c0864d19
Support untagged releases (#19509) 2020-07-31 20:47:28 +01:00
Dan Abramov
5d271fc3b1
Revert "Support untagged releases (#19507)" (#19508)
This reverts commit 58b3ee7a88.
2020-07-31 19:57:32 +01:00
Dan Abramov
58b3ee7a88
Support untagged releases (#19507)
* Support untagged releases

* Fix
2020-07-31 19:18:37 +01:00
Dan Abramov
7543459a48
Allow publishing untagged releases (#19505) 2020-07-31 16:10:01 +01:00
Ricky
74cd7e5f17
Use feature flags for React Native in the test renderer (#19486) 2020-07-29 16:31:05 -04:00
Ricky
7c8cc4358e
Add postTask browser scheduler implementation (#19479)
* Reduce code to necessities

* Switch to postTask API

* Add SchedulerPostTask tests

* Updates from review

* Fix typo from review

* Generate build of unstable_post_task
2020-07-29 15:27:59 -04:00
Ricky
52c5146274
Add SchedulerHostConfig fork for post task (#19470) 2020-07-28 11:11:31 -04:00
Ricky
c9749d38e3
Generate RN renderers for stable builds (#19421)
* Generate RN renderers for experimental builds

* Don't generate FB builds for experimental channels
2020-07-20 17:15:06 -04:00
Sebastian Markbåge
ab1f517000
isFBBundle should be true if it's FB for www or FB for RN (#19420)
This ensures that the .fb.js override files kick in for RN. Otherwise we
won't have FB specific exports in the isomorphic modules.
2020-07-20 10:37:04 -07:00
Ricky
bc4cd92cd5
Use jest-environment-jsdom-sixteen (#19288)
* Use jest-environment-jsdom-sixteen

* Update yarn.lock

* Dedupe new jest packages in yarn.lock

* Pull upstream changes
2020-07-16 10:17:31 -04:00
Dan Abramov
4961833dbf Don't build shallow renderer UMD bundles 2020-07-15 16:53:02 +01:00
Dan Abramov
2663a12eb3 Tweak wording 2020-07-10 14:56:28 +01:00
Brian Vaughn
e760d1fb0f
Fixed test script for DevTools build config (#19295) 2020-07-09 10:49:33 -04:00
Dominic Gannaway
4eb9b1d2b4
Refactor createEventHandle signature (#19174) 2020-07-07 13:05:06 +01:00
Dominic Gannaway
0c0aaeb6bc
Handle test-cli failure case for CI (#19265) 2020-07-06 22:05:51 +01:00
Dan Abramov
e3f4eb7272
Fork legacy-events folder into react-dom and react-native (#19228) 2020-07-01 16:37:13 +01:00
Dan Abramov
b231445f96
Move responder tests and remove dead code (#19226) 2020-07-01 16:20:49 +01:00
Dominic Gannaway
b2bac7311a
Remove React Flare Keyboard responder (#19222) 2020-07-01 15:43:16 +01:00
Dan Abramov
47ff31a77a
Revert "Add regression test for #18497 (#18538)" (#19215)
This reverts commit e9c1445ba0.
2020-06-30 13:38:31 +01:00
Vetrivel Chinnasamy
b621dab5d4
make link https (#19147) 2020-06-30 12:43:52 +01:00
Sophie Alpert
e9c1445ba0
Add regression test for #18497 (#18538) 2020-06-30 12:09:05 +01:00
Brian Vaughn
9d9cf383c9
Fixed test script handling of unknown/additional args (#19209) 2020-06-29 15:36:45 -04:00
Ricky
72bbcad160
Add new test cli (#19184)
* Add new test cli

* Remove --variant accidentally added to test-persist

* s/test/tests

* Updates from review

* Update package.json tests

* Missed a release channel in circle.yaml

* Update config.yml to use just run: with test commands

* Update release-channel options and add build dir checks

* Update test args to use the new release-channel options

* Fix error in circle config.yml

* Fix a wrong condition for the --variant check

* Fix a wrong condition for the --persistent check

* Prettier

* Require build check for devtool tests as well
2020-06-25 20:39:50 -04:00