Commit Graph

14151 Commits

Author SHA1 Message Date
Brian Vaughn
9cf1069ffc DevTools: Fixed version range NPM syntax 2021-05-14 10:14:34 -04:00
Sebastian Markbåge
5890e0e692 Remove data-reactroot from server rendering and hydration heuristic (#20996)
This was used to implicitly hydrate if you call ReactDOM.render.

We've had a warning to explicitly use ReactDOM.hydrate(...) instead of
ReactDOM.render(...). We can now remove this from the generated markup.
(And avoid adding it to Fizz.)

This is a little strange to do now since we're trying hard to make the
root API work the same.

But if we kept it, we'd need to keep it in the generated output which adds
unnecessary bytes. It also risks people relying on it, in the Fizz world
where as this is an opportunity to create that clean state.

We could possibly only keep it in the old server rendering APIs but then
that creates an implicit dependency between which server API and which
client API that you use. Currently you can really mix and match either way.
2021-05-13 10:18:21 -07:00
Andrew Clark
46491dce96 [Bugfix] Prevent already-committed setState callback from firing again during a rebase (#21498)
* Failing test: Class callback fired multiple times

Happens during a rebase (low priority update followed by high priority
update). The high priority callback gets fired twice.

* Prevent setState callback firing during rebase

Before enqueueing the effect, adds a guard to check if the update was
already committed.
2021-05-12 10:40:17 -07:00
Andrew Clark
b770f75005 lint-build: Infer format from artifact filename (#21489)
Uses the layout of the build artifact directory to infer the format
of a given file, and which lint rules to apply.

This has the effect of decoupling the lint build job from the existing
Rollup script, so that if we ever add additional post-processing, or
if we replace Rollup, it will still work.

But the immediate motivation is to replace the separate "stable" and
"experimental" lint-build jobs with a single combined job.
2021-05-12 10:14:45 -07:00
Brian Vaughn
2bf4805e4b Update entry point exports (#21488)
The following APIs have been added to the `react` stable entry point:
* `SuspenseList`
* `startTransition`
* `unstable_createMutableSource`
* `unstable_useMutableSource`
* `useDeferredValue`
* `useTransition`

The following APIs have been added or removed from the `react-dom` stable entry point:
* `createRoot`
* `unstable_createPortal` (removed)

The following APIs have been added to the `react-is` stable entry point:
* `SuspenseList`
* `isSuspenseList`

The following feature flags have been changed from experimental to true:
* `enableLazyElements`
* `enableSelectiveHydration`
* `enableSuspenseServerRenderer`
2021-05-12 11:28:14 -04:00
Ricky
b8fda6cabc [React Native] Set allowConcurrentByDefault = true (#21491) 2021-05-11 10:12:46 -04:00
Brian Vaughn
3890fb52fe Update devtools_bug_report.yml 2021-05-08 10:46:02 -04:00
Brian Vaughn
57768ef90b Update devtools_bug_report.yml
Tweaked label to include emoji characters.
2021-05-07 09:10:50 -04:00
Brian Vaughn
e468072e17 Updated release scripts to work around GitHub / Circle CI integration problems (#21434) 2021-05-07 08:53:39 -04:00
Brian Vaughn
0a8fefca4c DevTools 4.13.1 -> 4.13.2 2021-05-07 08:52:02 -04:00
Brian Vaughn
6005a6ab2b Update devtools_bug_report.yml 2021-05-07 08:48:34 -04:00
Brian Vaughn
85b543c6b4 Added new GitHub issue form for React DevTools bug reports (#21450)
Added a new bug report template built with GitHub issue forms:
https://gh-community.github.io/issue-template-feedback/structured/

And updated DevTools bug report link to send information formatted for this new template.
2021-05-07 08:46:58 -04:00
faebzz
1bb8987cc9 Renamed function in error log issue #21446 (#21449) 2021-05-06 21:03:21 -04:00
Joshua Gross
bd070eb2c4 Enable setJSResponder/setIsJSResponder for React Native Fabric (#21439)
* Enable setJSResponder/setIsJSResponder for React Native

* yarn prettier

* add types to react-native-host-hooks

* yarn prettier

* mock setIsJSResponder
2021-05-05 21:09:04 -07:00
Sebastian Markbåge
46ef1ab32a Convert emulated-Fizz PartialHydration tests to Fizz tests (#21437) 2021-05-05 21:22:27 -04:00
Sebastian Markbåge
212d2909d3 [Fizz] Make some tests more resilient to implementation details (#21438)
* Make some tests resilient against changing the specifics of the HTML

This ensures that for example flipping order of attributes doesn't matter.

* Use getVisibleChildren approach for more resilient tests
2021-05-05 16:13:45 -07:00
Gang Chen
12751d2991 fix: version in nvmrc (#21430) 2021-05-05 12:39:06 -04:00
Sebastian Markbåge
8ea11306ad Allow complex objects as children of option only if value is provided (#21431) 2021-05-05 08:40:54 -07:00
Brian Vaughn
014edf1980 Prepare DevTools 4.13.1 release 2021-05-04 22:35:30 -04:00
Brian Vaughn
67ebdf88bf Fix DevTools bug with Suspense+LegacyHidden component (#21432) 2021-05-04 22:28:17 -04:00
Ricky
e9a4a44aae Add back root override for strict mode (#21428)
* Add back root override for strict mode

* Switch flag to boolean

* Fix flow
2021-05-04 15:42:48 -04:00
Brian Vaughn
d1542de3a6 Unify React.memo and React.forwardRef display name logic (#21392)
Co-authored-by: iChenLei <2470828450@qq.com>
2021-05-04 11:40:16 -04:00
Brian Vaughn
d19257b8fa DevTools Store emits errors before throwing (#21426)
The Store should never throw an Error without also emitting an event. Otherwise Store errors will be invisible to users, but the downstream errors they cause will be reported as bugs. (For example, github.com/facebook/react/issues/21402)

Emitting an error event allows the ErrorBoundary to show the original error.

Throwing is still valuable for local development and for unit testing the Store itself.
2021-05-04 10:46:26 -04:00
Sebastian Markbåge
442eb21e0e Allow dangerouslySetInnerHTML in <option> (#21373) 2021-05-04 07:45:54 -07:00
Brian Vaughn
9a130e1dec StrictMode includes strict effects by default (#21418)
Removed "unstable_level" attribute support for the time being.
2021-05-04 09:47:06 -04:00
Brian Vaughn
b522638b99 Add GitHub API query to bug report template (#21421)
This may help debug why sometimes the GitHub API search seems to not find a match when it should.
2021-05-04 00:09:11 -04:00
Brian Vaughn
4ca62cac45 Improve DevTools bug template text (#21413) 2021-05-03 16:57:17 -04:00
Brian Vaughn
15fb8c3045 createRoot API is no longer strict by default (#21417) 2021-05-03 16:57:03 -04:00
Andrew Clark
aea7c2aab1 Re-land "Support nesting of startTransition and flushSync (alt) (#21149)"
This re-lands commit faa1e127f1ba755da846bc6ce299cdefaf97721f.
2021-05-03 13:40:13 -05:00
Andrew Clark
bacc87068a Re-land "Flush discrete passive effects before paint (#21150)"
This re-lands commit 2e7aceeb5c8b6e5c61174c0e9731e263e956e445.
2021-05-03 13:36:38 -05:00
Andrew Clark
098600c42a Re-land "Fix: flushSync changes priority inside effect (#21122)"
This re-lands commit 0e3c7e1d62efb6238b69e5295d45b9bd2dcf9181.
2021-05-03 13:36:17 -05:00
Andrew Clark
df420bc0a3 Re-land "Delete LanePriority type (#21090)"
This re-lands commit 26ddc63f2dcc8e7dcbacf498237a2bb1e28a7d23.
2021-05-03 13:35:51 -05:00
Andrew Clark
ab5b379275 Re-land "Clean up host pointers in level 2 of clean-up flag (#21112)"
This re-lands commit 8ed0c85bf174ce6e501be62d9ccec1889bbdbce1.
2021-05-03 13:35:19 -05:00
Andrew Clark
fd907c1f15 Re-land "Use highest priority lane to detect interruptions (#21088)""
This re-lands commit b4044f8a07323bcad7d55cbaedc35c35b4acf7e0.
2021-05-03 13:34:19 -05:00
Ricky
79740da4c6 Update time-slicing demo (#21401) 2021-04-30 20:50:59 -04:00
Brian Vaughn
b6644fabb9 Added test fixture for scheduling profiler (#21397) 2021-04-30 15:23:45 -04:00
Andrew Clark
269dd6ec5d subtreeFlag warning: Fix legacy suspense false positive (#21388)
Legacy Suspense is weird. We intentionally commit a suspended fiber in
an inconsistent state. If the fiber suspended before it mounted any
effects, then the fiber won't have a PassiveStatic effect flag, which
will trigger the "missing expected subtreeFlag" warning.

To avoid the false positive, we'd need to mark fibers that commit in an
incomplete state, somehow. For now I'll disable the warning in legacy
mode, with the assumption that most of the bugs that would trigger it
are either exclusive to concurrent mode or exist in both.
2021-04-29 08:28:38 -05:00
Brian Vaughn
3c21aa855a DevTools refactor Profiler commit tree reconstruction to be iterative (#21383) 2021-04-28 16:32:35 -04:00
Ricky
9e9dac6505 Add unstable_concurrentUpdatesByDefault (#21227) 2021-04-28 16:09:30 -04:00
Andrew Clark
86f3385d9a Revert "Use highest priority lane to detect interruptions (#21088)"
This reverts commit b4044f8a07323bcad7d55cbaedc35c35b4acf7e0.

Instead of LanePriority.

I'm removing all uses of LanePriority so I can delete it.
2021-04-28 11:56:55 -05:00
Andrew Clark
c6702656ff Revert "Clean up host pointers in level 2 of clean-up flag (#21112)"
This reverts commit 8ed0c85bf174ce6e501be62d9ccec1889bbdbce1.

The host tree is a cyclical structure. Leaking a single DOM node can
retain a large amount of memory. React-managed DOM nodes also point
back to a fiber tree.

Perf testing suggests that disconnecting these fields has a big memory
impact. That suggests leaks in non-React code but since it's hard to
completely eliminate those, it may still be worth the extra work to
clear these fields.

I'm moving this to level 2 to confirm whether this alone is responsible
for the memory savings, or if there are other fields that are retaining
large amounts of memory.

In our plan for removing the alternate model, DOM nodes would not be
connected to fibers, except at the root of the whole tree, which is
easy to disconnect on deletion. So in that world, we likely won't have
to do any additional work.
2021-04-28 11:56:54 -05:00
Andrew Clark
1bd41c6645 Revert "Delete LanePriority type (#21090)"
This reverts commit 26ddc63f2dcc8e7dcbacf498237a2bb1e28a7d23.

No longer using LanePriority anywhere, so this deletes the
remaining references.
2021-04-28 11:56:54 -05:00
Andrew Clark
e7e0a90bd8 Revert "Fix: flushSync changes priority inside effect (#21122)"
This reverts commit 0e3c7e1d62efb6238b69e5295d45b9bd2dcf9181.

When called from inside an effect, flushSync cannot synchronously flush
its updates because React is already working. So we fire a warning.

However, we should still change the priority of the updates to sync so
that they flush at the end of the current task.

This only affects useEffect because updates inside useLayoutEffect (and
the rest of the commit phase, like ref callbacks) are already sync.
2021-04-28 11:56:54 -05:00
Andrew Clark
7bac7607a7 Revert "Flush discrete passive effects before paint (#21150)"
This reverts commit 2e7aceeb5c8b6e5c61174c0e9731e263e956e445.

If a discrete render results in passive effects, we should flush them
synchronously at the end of the current task so that the result is
immediately observable. For example, if a passive effect adds an event
listener, the listener will be added before the next input.

We don't need to do this for effects that don't have discrete/sync
priority, because we assume they are not order-dependent and do not
need to be observed by external systems.

For legacy mode, we will maintain the existing behavior, since it hasn't
been reported as an issue, and we'd have to do additional work to
distinguish "legacy default sync" from "discrete sync" to prevent all
passive effects from being treated this way.
2021-04-28 11:56:54 -05:00
Andrew Clark
207d4c3a53 Revert "Support nesting of startTransition and flushSync (alt) (#21149)"
This reverts commit faa1e127f1ba755da846bc6ce299cdefaf97721f.

* Support nesting of startTransition and flushSync

* Unset transition before entering any special execution contexts

Co-authored-by: Andrew Clark <git@andrewclark.io>
2021-04-28 11:56:54 -05:00
Brian Vaughn
2a7bb41548 Preparing DevTools 4.12.4 -> 4.13.0 release (#21378) 2021-04-28 12:36:24 -04:00
Brian Vaughn
7edd628134 Removed (deleted) tracing fixture test from relesae scripts 2021-04-28 12:36:09 -04:00
Brian Vaughn
a0d6b155dc DevTools should iterate over siblings during mount (#21377)
Previously, DevTools recursed over both children and siblings during mount. This caused potential stack overflows when there were a lot of children (e.g. a list containing many items).

Given the following example component tree:

       A
    B  C  D
    E     F
          G

A method that recurses for every child and sibling leads to a max depth of 6:

    A
    A -> B
    A -> B -> E
    A -> B -> C
    A -> B -> C -> D
    A -> B -> C -> D -> F
    A -> B -> C -> D -> F -> G

The stack gets deeper as the tree gets either deeper or wider.

A method that recurses for every child and iterates over siblings leads to a max depth of 4:

    A
    A -> B
    A -> B -> E
    A -> C
    A -> D
    A -> D -> F
    A -> D -> F -> G

The stack gets deeper as the tree gets deeper but is resilient to wide trees (e.g. lists containing many items).
2021-04-28 10:29:22 -04:00
Brian Vaughn
a5267faad5 Updated DevTools CHANGELOG for 4.10 releases 2021-04-28 08:58:27 -04:00
Brian Vaughn
5196a95fd1 Updated DevTools to replace fburl.com link with fb.me link 2021-04-27 23:49:30 -04:00