Commit Graph
14163 Commits
Author SHA1 Message Date
Brian VaughnandGitHub dfb8ebf078 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 fa8f73c1d6 Updated DevTools CHANGELOG for 4.13.3 release 2021-05-19 10:59:32 -04:00
Brian VaughnandGitHub fc7ed12d54 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 VaughnandGitHub 266a011709 DevTools bugfix for useState() with hasOwnProperty key (#21524) 2021-05-18 16:43:33 -04:00
Brian Vaughn 26f6d06aa0 Added React entry-points change to DevTools changelog 2021-05-18 13:25:29 -04:00
Brian Vaughn 8fdba3b1be Preparing DevTools 4.13.2 -> 4.13.3 for release 2021-05-18 13:23:06 -04:00
Brian VaughnandGitHub 14e0db6322 Fixed another Symbol concatenation issue with DevTools format() util (#21521) 2021-05-18 11:46:04 -04:00
Brian VaughnandGitHub 68db562f66 DevTools: Reload all roots after Fast Refresh force remount (#21516)
Works around the corrupted Store state by detecting a broken Fast Refresh remount and forcefully dropping the root and re-mounting the entire tree. This prevents Fibers from getting duplicated in the Store (and in the Components tree). The benefit of this approach is that it doesn't rely on an update or change in behavior to Fast Refresh. (This workaround is pretty dirty, but since it's a DEV-only code path, it's probably okay.)

Note that this change doesn't fix all of the reported issues (see #21442 (comment)) but it does fix some of them.

This commit also slightly refactors the way DevTools assigns and manages unique IDs for Fibers in the backend by removing the indirection of a "primary Fiber" and instead mapping both the primary and alternate.

It also removes the previous cache-on-read behavior of getFiberID and splits the method into three separate functions for different use cases:
* getOrGenerateFiberID – Like the previous function, this method returns an ID or generates and caches a new one if the Fiber hasn't been seen before.
* getFiberIDUnsafe – This function returns an ID if one has already been generated or null if not. (It can be used to e.g. log a message about a Fiber without potentially causing it to leak.)
* getFiberIDThrows – This function returns an ID if one has already been generated or it throws. (It can be used to guarantee expected behavior rather than to silently cause a leak.)
2021-05-18 11:42:08 -04:00
Brian VaughnandGitHub 71dadb6ecb Errors thrown by Store can be dismissed in boundary (#21520) 2021-05-18 10:36:31 -04:00
Brian VaughnandGitHub 73af20c592 Make StrictMode double rendering flag static for FB/www (#21517) 2021-05-18 10:07:58 -04:00
RickyandGitHub a0602c3341 Clean up Scheduler forks (#20915)
* Clean up Scheduler forks

* Un-shadow variables

* Use timer globals directly, add a test for overrides

* Remove more window references

* Don't crash for undefined globals + tests

* Update lint config globals

* Fix test by using async act

* Add test fixture

* Delete test fixture
2021-05-17 16:53:58 -04:00
Brian Vaughn c7c3ac5f15 Tweaked DevTools error template title to match issue form template 2021-05-14 10:19:58 -04:00
Brian Vaughn cedb3adb75 DevTools: Fixed version range NPM syntax 2021-05-14 10:14:34 -04:00
Sebastian MarkbågeandGitHub 4d1ffac1b2 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 ClarkandGitHub 79ec38cafd [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 ClarkandGitHub 1f05c49a5d 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 VaughnandGitHub b86ad519ba 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
RickyandGitHub 4653d64b0e [React Native] Set allowConcurrentByDefault = true (#21491) 2021-05-11 10:12:46 -04:00
Brian VaughnandGitHub 2060e6ca41 Update devtools_bug_report.yml 2021-05-08 10:46:02 -04:00
Brian VaughnandGitHub 158a84b669 Update devtools_bug_report.yml
Tweaked label to include emoji characters.
2021-05-07 09:10:50 -04:00
Brian VaughnandGitHub 6d7bbe9b19 Updated release scripts to work around GitHub / Circle CI integration problems (#21434) 2021-05-07 08:53:39 -04:00
Brian Vaughn e5aeab0276 DevTools 4.13.1 -> 4.13.2 2021-05-07 08:52:02 -04:00
Brian VaughnandGitHub 7976a018d7 Update devtools_bug_report.yml 2021-05-07 08:48:34 -04:00
Brian VaughnandGitHub 2ff1c3964e 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
faebzzandGitHub 75cd759b42 Renamed function in error log issue #21446 (#21449) 2021-05-06 21:03:21 -04:00
Joshua GrossandGitHub f0756668cf 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ågeandGitHub 0dee6f4890 Convert emulated-Fizz PartialHydration tests to Fizz tests (#21437) 2021-05-05 21:22:27 -04:00
Sebastian MarkbågeandGitHub 5b7944c742 [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 ChenandGitHub 96286975cd fix: version in nvmrc (#21430) 2021-05-05 12:39:06 -04:00
Sebastian MarkbågeandGitHub b14e3fef19 Allow complex objects as children of option only if value is provided (#21431) 2021-05-05 08:40:54 -07:00
Brian Vaughn 4bfee83725 Prepare DevTools 4.13.1 release 2021-05-04 22:35:30 -04:00
Brian VaughnandGitHub 997683098b Fix DevTools bug with Suspense+LegacyHidden component (#21432) 2021-05-04 22:28:17 -04:00
RickyandGitHub 0f69384946 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
527633288c Unify React.memo and React.forwardRef display name logic (#21392)
Co-authored-by: iChenLei <[email protected]>
2021-05-04 11:40:16 -04:00
Brian VaughnandGitHub cef8b51dd5 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ågeandGitHub 57f28494a3 Allow dangerouslySetInnerHTML in <option> (#21373) 2021-05-04 07:45:54 -07:00
Brian VaughnandGitHub a740f1bec0 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 VaughnandGitHub cc7abe23e7 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 VaughnandGitHub 6c1407704b Improve DevTools bug template text (#21413) 2021-05-03 16:57:17 -04:00
Brian VaughnandGitHub f9bcab4910 createRoot API is no longer strict by default (#21417) 2021-05-03 16:57:03 -04:00
Andrew Clark e74d77363d 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 72971df2bc Re-land "Flush discrete passive effects before paint (#21150)"
This re-lands commit 2e7aceeb5c8b6e5c61174c0e9731e263e956e445.
2021-05-03 13:36:38 -05:00
Andrew Clark 7d3aec61c0 Re-land "Fix: flushSync changes priority inside effect (#21122)"
This re-lands commit 0e3c7e1d62efb6238b69e5295d45b9bd2dcf9181.
2021-05-03 13:36:17 -05:00
Andrew Clark 7f48fa597a Re-land "Delete LanePriority type (#21090)"
This re-lands commit 26ddc63f2dcc8e7dcbacf498237a2bb1e28a7d23.
2021-05-03 13:35:51 -05:00
Andrew Clark 975251570c 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 a6816b3e9b Re-land "Use highest priority lane to detect interruptions (#21088)""
This re-lands commit b4044f8a07323bcad7d55cbaedc35c35b4acf7e0.
2021-05-03 13:34:19 -05:00
RickyandGitHub 74a04efbdc Update time-slicing demo (#21401) 2021-04-30 20:50:59 -04:00
Brian VaughnandGitHub f160f7cb74 Added test fixture for scheduling profiler (#21397) 2021-04-30 15:23:45 -04:00
Andrew ClarkandGitHub 0d099c7f83 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 VaughnandGitHub 705da32b3f DevTools refactor Profiler commit tree reconstruction to be iterative (#21383) 2021-04-28 16:32:35 -04:00