Commit Graph

14209 Commits

Author SHA1 Message Date
Shannon Feng b610fec00c fix comments: expiration time -> lanes (#21551) 2021-06-05 07:19:40 -07:00
Dan Abramov 23c80959ad Fix CSS 2021-06-04 23:12:01 +01:00
Dan Abramov 2568fecc38 Tweak fixture 2021-06-04 23:10:02 +01:00
Dan Abramov fccfc24893 [Fizz] Add another fixture (#21627) 2021-06-04 23:04:06 +01:00
Dan Abramov cc4d24ab0b [Fizz] Always call flush() if it exists (#21625) 2021-06-04 20:17:57 +01:00
Ikko Ashimine 46926993fc Fix typo in bridge.js (#21621) 2021-06-04 11:42:09 -04:00
Sebastian Markbåge e0d9b28999 [Fizz] Minor Fixes for Warning Parity (#21618) 2021-06-03 19:54:31 -04:00
Sebastian Markbåge 1b7b3592f4 [Fizz] Implement Component Stacks in DEV for warnings (#21610)
* Implement component stacks

This uses a reverse linked list in DEV-only to keep track of where we're
currently executing.

* Fix bug that wasn't picking up the right stack at suspended boundaries

This makes it more explicit which stack we pass in to be retained by the
task.
2021-06-03 13:02:41 -07:00
Brian Vaughn 39f0074892 Make enableSuspenseLayoutEffectSemantics static for www (#21617)
This has been ramped up to 80% GK so the next step is to just turn it on for 100%
2021-06-03 15:40:59 -04:00
Andrew Clark 7747a5684d Support @latest in prepare-release-from-ci (#21616)
Since we track these versions in source, we can build `@latest`
releases in CI and store them as artifacts.

Then when it's time to release, and the build has been verified, we use
`prepare-release-from-ci` (the same script we use for `@next` and
`@experimental`) to fetch the already built and versioned packages.
2021-06-03 11:00:08 -07:00
Andrew Clark 8f37942765 Prepare semver (@latest) releases in CI (#21615)
Now that we track package versions in source, `@latest` builds should
be fully reproducible for a given commit. We can prepare the packages in
CI and store them as artifacts, the same way we do for `@next` and
`@experimental`.

Eventually this can replace the interactive script that we currently
use to swap out the version numbers.

The other nice thing about this approach is that we can run tests in CI
to verify that the packages are releasable, instead of waiting until
right before publish.

I named the output directory `oss-stable-semver`, to distinguish from
the `@next` prereleases that are located at `oss-stable`. I don't love
this naming. I'd prefer to use the name of the corresponding npm dist
tag. I'll do that in a follow-up, though, since the `oss-stable` name is
referenced in a handful of places.

Current naming (after this PR):

- `oss-experimental` → `@experimental`
- `oss-stable` → `@next`
- `oss-stable-semver` → `@latest`

Proposed naming (not yet implemented, requires more work):

- `oss-experimental` → `@experimental`
- `oss-next` → `@next`
- `oss-latest` → `@latest`
2021-06-03 10:26:11 -07:00
Andrew Clark 44cdfd6b7a Use ReactVersions module as package allowlist (#21613)
Instead of keeping a separate allowlist in sync, we use ReactVersions.js
as the source of truth for which packages get published.
2021-06-03 11:45:10 -04:00
Bao Pham 8b4201535c Devtools: add feature to trigger an error boundary (#21583)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2021-06-03 11:21:44 -04:00
Sebastian Markbåge 2418f24b60 Fix <select> check of defaultValue/value type (#21611) 2021-06-03 09:13:00 -04:00
Andrew Clark 154a8cf328 Fix reference to wrong variable
Follow-up to #21608
2021-06-03 00:23:08 -04:00
Andrew Clark 6736a38b9a Add single source of truth for package versions (#21608)
The versioning scheme for `@next` releases does not include semver
information. Like `@experimental`, the versions are based only on the
hash, i.e. `0.0.0-<commit_sha>`. The reason we do this is to prevent
the use of a tilde (~) or caret (^) to match a range of
prerelease versions.

For `@experimental`, I think this rationale still makes sense — those
releases are very unstable, with frequent breaking changes. But `@next`
is not as volatile. It represents the next stable release. So, I think
we can afford to include an actual verison number at the beginning of
the string instead of `0.0.0`.

We can also add a label that indicates readiness of the upcoming
release, like "alpha", "beta", "rc", etc.

To prepare for this the new versioning scheme, I updated the build
script. However, **this PR does not enable the new versioning scheme
yet**. I left a TODO above the line that we'll change once we're ready.

We need to specify the expected next version numbers for each package,
somewhere. These aren't encoded anywhere today — we don't specify
version numbers until right before publishing to `@latest`, using an
interactive script: `prepare-release-from-npm`.

Instead, what we can do is track these version numbers in a module. I
added `ReactVersions.js` that acts as the single source of truth for
every package's version. The build script uses this module to build the
`@next` packages.

In the future, I want to start building the `@latest` packages the same
way we do `@next` and `@experimental`. (What we do now is download a
`@next` release from npm and swap out its version numbers.) Then we
could run automated tests in CI to confirm the packages are releasable,
instead of waiting to verify that right before publish.
2021-06-02 20:54:26 -07:00
Sebastian Markbåge 86715efa23 Resolve the true entry point during tests (#21505)
* Resolve the entry point for tests the same way builds do

This way the source tests, test the same entry point configuration.

* Gate test selectors on www

These are currently only exposed in www builds

* Gate createEventHandle / useFocus on www

These are enabled in both www variants but not OSS experimental.

* Temporarily disable www-modern entry point

Use the main one that has all the exports until we fix more tests.

* Remove enableCache override that's no longer correct

* Open gates for www

These used to not be covered because they used Cache which wasn't exposed.
2021-06-02 18:03:29 -07:00
Sebastian Markbåge a8a4742f1c Convert ES6/TypeScript/CoffeeScript Tests to createRoot + act (#21598)
* Convert ES6/TypeScript CoffeeScript Tests to createRoot + act

* Change expectation for WWW+VARIANT because the deferRenderPhaseUpdateToNextBatch flag breaks this behavior
2021-06-02 11:36:59 -07:00
Sebastian Markbåge 1d3558965f Disable deferRenderPhaseUpdateToNextBatch by default (#21605)
We're still experimenting with this and it causes a breaking behavior
for setState in componentWillMount/componentWillReceiveProps atm.
2021-06-02 11:28:06 -07:00
okmttdhr a8964649bb Delete an unused field (#21415) 2021-06-02 16:24:40 +01:00
Dan Abramov 76f85b3e50 Expose Fizz in stable builds (#21602) 2021-06-02 16:13:19 +01:00
Andrew Clark e16d61c300 [Offscreen] Mount/unmount layout effects (#21386)
* [Offscreen] Mount/unmount layout effects

Exposes the Offscreen component type and implements basic support for
mount/unmounting layout effects when the visibility is toggled.

Mostly it works the same way as hidden Suspense trees, which use the
same internal fiber type. I had to add an extra bailout, though, that
doesn't apply to the Suspense case but does apply to Offscreen
components: a hidden Offscreen tree will eventually render at low
priority, and when we it does, its `subtreeTag` will have effects
scheduled on it. So I added a check to the layout phase where, if the
subtree is hidden, we skip over the subtree entirely. An alternate
design would be to clear the subtree flags in the render phase, but I
prefer doing it this way since it's harder to mess up.

We also need an API to enable the same thing for passive effects. This
is not yet implemented.

* Add test starting from hidden

Co-authored-by: Rick Hanlon <rickhanlonii@gmail.com>
2021-06-01 12:46:08 -07:00
Brian Vaughn 63091939bd OSS feature flag updates (#21597)
Co-authored-by: Dan Abramov <dan.abramov@me.com>
2021-06-01 13:44:10 -04:00
Sebastian Markbåge efbd69b27e Define global __WWW__ = true flag during www tests (#21504)
* Define global __WWW__ = true flag during www tests

We already do that for __PERSISTENT__.

* Use @gate www in ReactSuspenseCallback

This allows it to not be internal anymore. We test it against the www build.
2021-06-01 10:16:06 -07:00
Sebastian Markbåge 8f6163cbed Fix Fizz exported types (#21596) 2021-06-01 10:02:04 -07:00
Brian Vaughn 28625c6f45 Disable strict effects for legacy roots (again) (#21591) 2021-05-31 13:05:50 -04:00
Brian Vaughn d75105fa92 DevTools: Format error message (#21580)
To support GitHub API fuzzy issue search
2021-05-27 15:44:14 -04:00
Sebastian Silbermann 3c2341416a Update jest to v26 (#21574)
* Install jest 26

* jsdom env now uses 16 by default

* require.requireActual -> jest.requireActual

* deduplicate added deps
2021-05-27 16:33:57 +01:00
Brian Vaughn 5151466bab Updated DevTools bug Workflow
Workflow now auto-assigns issues needing more information to the person who reported them
2021-05-27 09:49:44 -04:00
Pulkit Sharma 0d493dcda9 Removed _debugID field from Fiber - Issue #21558 (#21570)
* Removed _debugID field from Fiber
* Update ReactFunctionComponent-test.js

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2021-05-26 16:53:18 -04:00
Brian Vaughn bb1c821556 Fixed localhost URL check
Noticed that it missed 21568 because of a leading "/"
2021-05-26 10:43:51 -04:00
Brian Vaughn 7841d0695a Enable the updater-tracking feature flag in more builds (#21567) 2021-05-25 17:41:19 -04:00
Brian Vaughn 6405efc368 Enabled Profiling feature flags for OSS release (#21565)
* Enabled Profiling feature flags for OSS release

`enableProfilerCommitHooks` and `enableProfilerNestedUpdatePhase`
2021-05-25 17:32:14 -04:00
Brian Vaughn 0ae5290b54 DevTools 4.13.4 -> 4.13.5 2021-05-25 15:18:47 -04:00
Brian Vaughn 965fb8be6b DevTools: Support an element mounting before its owner (#21562) 2021-05-25 14:49:05 -04:00
Ricky 2d8d133e17 Turn on enableSyncDefaultUpdates everywhere (#21548) 2021-05-25 11:21:58 -04:00
Samuel Susla 459c34fde6 Add flag concurrent root to Fabric render function (#21552)
* Add flag concurrent root to Fabric render function

* Lint
2021-05-24 10:56:47 -04:00
Brian Vaughn a731a51696 Add GitHub action to check for bug repro (#21542) 2021-05-21 15:48:12 -04:00
Brian Vaughn 51ebccc374 DevTools: Add 4.13.4 changelog 2021-05-20 17:00:17 -04:00
Brian Vaughn 97c25b0e9c DevTools: Add 4.10.4 to CHANGELOG 2021-05-20 16:31:18 -04:00
Brian Vaughn 45f1a4a33f DevTools: Revert force deep re-mount when Fast Refresh detected (#21539)
This reverts the most expensive part of 1e3383a41 (which seems to no longer be necessary after subsequent changes).
2021-05-20 15:28:59 -04:00
Brian Vaughn e0bffeeb01 Update devtools_bug_report.yml 2021-05-20 14:52:08 -04:00
Brian Vaughn 549aaacbb0 Update devtools_bug_report.yml 2021-05-20 14:51:35 -04:00
Brian Vaughn 132b72d7b6 DevTools 4.13.3 -> 4.13.4 2021-05-20 11:24:30 -04:00
Brian Vaughn b8bbb6a13d Fix edge-case Fast Refresh bug that caused Fibers with warnings/errors to be untracked prematurely (#21536)
Refactor error/warning count tracking to avoid pre-allocating an ID for Fibers that aren't yet mounted. Instead, we store a temporary reference to the Fiber itself and later check to see if it successfully mounted before merging pending error/warning counts.

This avoids a problematic edge case where a force-remounted Fiber (from Fast Refresh) caused us to untrack a Fiber that was still mounted, resulting in a DevTools error if that Fiber was inspected in the Components tab.
2021-05-20 11:24:08 -04:00
Brian Vaughn ebcec3cc20 Add key to inspected-element error boundary (#21535)
This way changing the selected element also recreates/resets the boundary automatically.
2021-05-19 17:38:12 -04:00
Brian Vaughn 99995c1063 Improve error boundary in inspected elements panel (#21531)
Show more info about the error as well as the option to report it to GitHub.
2021-05-19 13:27:56 -04:00
Brian Vaughn 3f8f4675d4 Updated DevTools CHANGELOG for 4.13.3 release 2021-05-19 10:59:32 -04:00
Brian Vaughn d6604ac031 Account for another DevTools + Fast Refresh edge case (#21523)
DevTools now 'untrack' Fibers (cleans up the ID-to-Fiber mapping) after a slight delay in order to support a Fast Refresh edge case:
1. Component type is updated and Fast Refresh schedules an update+remount.
2. flushPendingErrorsAndWarningsAfterDelay() runs, sees the old Fiber is no longer mounted (it's been disconnected by Fast Refresh), and calls untrackFiberID() to clear it from the Map.
3. React flushes pending passive effects before it runs the next render, which logs an error or warning, which causes a new ID to be generated for this Fiber.
4. DevTools now tries to unmount the old Component with the new ID.

The underlying problem here is the premature clearing of the Fiber ID, but DevTools has no way to detect that a given Fiber has been scheduled for Fast Refresh. (The '_debugNeedsRemount' flag won't necessarily be set.)

The best we can do is to delay untracking by a small amount, and give React time to process the Fast Refresh delay.
2021-05-18 22:44:29 -04:00
Brian Vaughn b15bf2b2f1 DevTools bugfix for useState() with hasOwnProperty key (#21524) 2021-05-18 16:43:33 -04:00