Commit Graph

14685 Commits

Author SHA1 Message Date
jstejada
5757919256 DevTools: Correctly log errors reported from the store (#22950) 2021-12-13 12:02:14 -05:00
jstejada
a049aa0155 [DevTools] Log errors occurring or reported to the frontend (#22948) 2021-12-13 11:38:45 -05:00
Brian Vaughn
3b3daf5573 Advocate for StrictMode usage within Components tree (#22886)
Adds the concept of subtree modes to DevTools to bridge protocol as follows:
1. Add-root messages get two new attributes: one specifying whether the root is running in strict mode and another specifying whether the root (really the root's renderer) supports the concept of strict mode.
2. A new backend message type (TREE_OPERATION_SET_SUBTREE_MODE). This type specifies a subtree root (id) and a mode (bitmask). For now, the only mode this message deals with is strict mode.

The DevTools frontend has been updated as well to highlight non-StrictMode compliant components.

The changes to the bridge protocol require incrementing the bridge protocol version number, which will also require updating the version of react-devtools-core backend that is shipped with React Native.
2021-12-10 11:05:18 -05:00
Brian Vaughn
2c1cf5618a DevTools should inject itself for XHTML pages too (not just HTML) (#22932) 2021-12-09 15:32:11 -05:00
salazarm
f2a59df48b Remove unstableAvoidThisFallback from OSS (#22884)
* avoidThisFallbackFlag

* avoidThisFallback flag

* missed a spot

* rm gating
2021-12-08 08:21:02 -08:00
Andrew Clark
d3001fb6f1 Use next as prerelease label
Instead of `rc`, which is redundant since it's in the next version
number already.
2021-12-08 10:57:25 -05:00
Andrew Clark
29d2bef9f5 Bump beta -> rc 2021-12-08 10:51:41 -05:00
Joey Arhar
24dd07bd26 Add custom element property support behind a flag (#22184)
* custom element props

* custom element events

* use function type for on*

* tests, htmlFor

* className

* fix ReactDOMComponent-test

* started on adding feature flag

* added feature flag to all feature flag files

* everything passes

* tried to fix getPropertyInfo

* used @gate and __experimental__

* remove flag gating for test which already passes

* fix onClick test

* add __EXPERIMENTAL__ to www flags, rename eventProxy

* Add innerText and textContent to reservedProps

* Emit warning when assigning to read only properties in client

* Revert "Emit warning when assigning to read only properties in client"

This reverts commit 1a093e584c.

* Emit warning when assigning to read only properties during hydration

* yarn prettier-all

* Gate hydration warning test on flag

* Fix gating in hydration warning test

* Fix assignment to boolean properties

* Replace _listeners with random suffix matching

* Improve gating for hydration warning test

* Add outerText and outerHTML to server warning properties

* remove nameLower logic

* fix capture event listener test

* Add coverage for changing custom event listeners

* yarn prettier-all

* yarn lint --fix

* replace getCustomElementEventHandlersFromNode with getFiberCurrentPropsFromNode

* Remove previous value when adding event listener

* flow, lint, prettier

* Add dispatchEvent to make sure nothing crashes

* Add state change to reserved attribute tests

* Add missing feature flag test gate

* Reimplement SSR changes in ReactDOMServerFormatConfig

* Test hydration for objects and functions

* add missing test gate

* remove extraneous comment

* Add attribute->property test
2021-12-08 15:11:42 +00:00
Andrew Clark
72e48b8e16 Fix: Don't skip writing updated package.json
Another fix to previous commit. The special case for
use-sync-external-store still needs to write out the updated
package.json, because we also use that branch to update the
version field.
2021-12-08 02:56:43 -05:00
Andrew Clark
e39b2c8998 Fix peer deps for use-sync-external-store
Merged last PR too quickly
2021-12-08 02:45:57 -05:00
Andrew Clark
ec78b135fb Don't override use-sync-external-store peerDeps (#22882)
Usually the build script updates transitive React dependencies so that
they refer to the corresponding release version.

For use-sync-external-store, though, we also want to support older
versions of React, too. So the normal behavior of the build script
isn't sufficient.

For now, to unblock, I hardcoded a special case, but we should consider
a better way to handle this in the future.
2021-12-07 23:26:12 -08:00
Andrew Clark
06f403481f Add CI job to check npm dependencies (#22881)
Checks that if one React package depends on another, the current
version satisfies the given dependency range.

That way we don't forget to bump dependencies when we release a
new version.
2021-12-07 23:09:00 -08:00
Brian Vaughn
ad607469c5 StyleX plug-in for resolving atomic styles to values for props.xstyle (#22808)
Adds the concept of "plugins" to the inspected element payload. Also adds the first plugin, one that resolves StyleX atomic style names to their values and displays them as a unified style object (rather than a nested array of objects and booleans).

Source file names are displayed first, in dim color, followed by an ordered set of resolved style values.

For builds with the new feature flag disabled, there is no observable change.

A next step to build on top of this could be to make the style values editable, but change the logic such that editing one directly added an inline style to the item (rather than modifying the stylex class– which may be shared between multiple other components).
2021-12-07 20:04:12 -05:00
salazarm
5041c37d27 Remove hydrate option from createRoot (#22878)
* remove hydrate: true option

* remove missed comment

* lint

* warning

* circumvent flow
2021-12-07 16:10:00 -05:00
salazarm
c7917fe769 Test showing that a mismatch at the root recovers with client render but shows loading state (#22873)
* rm console.log

* gate test

* move test

* show fallback state
2021-12-06 12:36:02 -05:00
jstejada
12bffc78d8 [DevTools] Emit new event when DevTools connects in standalone app (#22848) 2021-12-06 08:49:15 -05:00
salazarm
3f9480f0f5 enable continuous replay flag (#22863) 2021-12-03 19:35:20 -05:00
Brian Vaughn
8b8817845a Timeline search (#22799)
Refactor SearchInput component (used in Components tree) to be generic DevTools component with two uses: ComponentSearchInput and TimelineSearchInput.

Refactored Timeline Suspense to more closely match other, newer Suspense patterns (e.g. inspect component, named hooks) and colocated Susepnse code in timelineCache file.

Add search by component name functionality to the Timeline. For now, searching zooms in to the component measure and you can step through each time it rendered using the next/previous arrows.
2021-12-03 16:23:48 -05:00
Andrew Clark
4729ff6d1f Implement identifierPrefix option for useId (#22855)
When an `identifierPrefix` option is given, React will add it to the
beginning of ids generated by `useId`.

The main use case is to avoid conflicts when there are multiple React
roots on a single page.

The server API already supported an `identifierPrefix` option. It's not
only used by `useId`, but also for React-generated ids that are used to
stitch together chunks of HTML, among other things. I added a
corresponding option to the client.

You must pass the same prefix option to both the server and client.
Eventually we may make this automatic by sending the prefix from the
server as part of the HTML stream.
2021-12-02 17:49:43 -08:00
Dan Abramov
71d16750c5 Replay capture phase for continuous events (#22856)
Co-authored-by: Dan Abramov <dan.abramov@me.com>

Co-authored-by: Marco Salazar <salazarm@fb.com>
2021-12-02 14:33:44 +00:00
Dan Abramov
44f99d75fa Track currently replaying event (#22853)
* Track currently replaying event

Co-authored-by: Dan Abramov <dan.abramov@me.com>

* Add warnings

Co-authored-by: Marco Salazar <salazarm@fb.com>
2021-12-02 14:11:21 +00:00
Dan Abramov
e737ea9655 Fork dispatch function based on the flag (#22852)
* Fork function based on a flag

* Prune false branches

Co-authored-by: Marco Salazar <salazarm@fb.com>
2021-12-02 14:02:49 +00:00
Dan Abramov
ea5a413602 Decouple dispatching from attemptToDispatchEvent (#22851)
* Decoupled dispatching from attemptToDispatchEvent

* Remove unnecessary field

It is unnecessary because it's only true when retval is null.
2021-12-02 13:55:57 +00:00
Dan Abramov
ed00d2c3d8 Remove unused flag (#22854) 2021-12-02 02:25:32 +00:00
jstejada
a65ceef370 DevTools: Log version in internal logger (#22825) 2021-11-30 10:48:46 -05:00
Michelle Chen
0cc724c777 update ReactFlightWebpackPlugin to be compatiable with webpack v5 (#22739) 2021-11-25 22:43:22 +00:00
Sebastian Silbermann
ca106a02d1 Add imageSizes and imageSrcSet to know props (#22550)
* feat(react-dom): Add `imageSrcSet`

* feat(react-dom): Add `imageSizes`
2021-11-25 01:49:52 +00:00
Sebastian Silbermann
cbc484b5ae Update attribute-behavior fixture (#22522)
* Fix missing key warning

* Add build instructions

* Update interpretation now that React 17 is latest stable and 18 is next

* Ignore ReactDOM.render deprecation warning

* Ensure a server implementation with `renderToString` is used

* Update AttributeTableSnapshot

* Ensure Popover doesn't overflow
2021-11-25 01:37:09 +00:00
Simen Bekkhus
4e6eec69be fix: document can be null, not just undefined (#22695) 2021-11-24 20:51:15 +00:00
salazarm
c1220ebdde treat empty string as null (#22807) 2021-11-23 18:40:10 -05:00
Esteban
09d9b17757 Update deprecated features in ESLint configuration files. (#22767) 2021-11-23 22:53:26 +00:00
jstejada
a04795c89c Ensure react-is version used for resolution for playwright is installed (#22813) 2021-11-23 13:29:47 -05:00
Sebastian Silbermann
149b420f63 Ensure devtools e2e test use a compatible react-is version (#22790)
* Update lockfile by running `yarn install`

* Ensure devtools e2e test use a compatible react-is version
2021-11-19 10:18:02 -05:00
Sebastian Silbermann
bddbfb86d8 Revert "Fix Node package.json ./ exports deprecation warning (#22783)" (#22792)
This reverts commit 8edeb787b0.
2021-11-19 10:04:13 -05:00
anc95
b831aec48f chore(fast-refresh): double check wasMounted (#22740) 2021-11-18 21:15:07 +00:00
Esteban
b32b67706f Migrate from CLIEngine to the new ESLint class. (#22756)
* Migrate from CLIEngine to the new ESLint class.

* fix output property
2021-11-18 21:12:18 +00:00
Rin Arakaki
8edeb787b0 Fix Node package.json ./ exports deprecation warning (#22783) 2021-11-18 21:11:30 +00:00
salazarm
fdc1d617a4 Flag for client render fallback behavior on hydration mismatch (#22787)
* Add flag for new client-render fallback behavior on hydration mismatch

* gate test

* gate tests too

* fix test gating
2021-11-18 08:16:09 -05:00
hiro
f320ef88f5 fix(typo): Esacpe -> Escape (#22780) 2021-11-16 16:43:25 -05:00
Brian Vaughn
aa19d569b2 Add test selectors to experimental build (#22760)
This change adds a new "react-dom/unstable_testing" entry point but I believe its contents will exactly match "react-dom/index" for the stable build. (The experimental build will have the added new selector APIs.)
2021-11-16 16:27:10 -05:00
Jiachi Liu
520ffc77a3 Use globalThis if possible for native fetch in browser build (#22777) 2021-11-16 21:24:54 +00:00
Esteban
afbc2d08f4 Remove unused react-internal/invariant-args ESLint rule. (#22778) 2021-11-16 20:11:20 +00:00
Esteban
ca94e26802 Remove 'packages/shared/invariant.js' (#22779) 2021-11-16 20:11:11 +00:00
salazarm
4ff5f5719b Move unstable_scheduleHydration to ReactDOMHydrationRoot (#22455)
* move unstable_scheduleHydration to ReactDOMHydrationRoot

* move definition of schedule hydration

* fix test?

* prototype

* fix test

* remove gating because unstable_scheduleHydration is no longer gated through index.stable.js because its exposed through ReactDOMHydrationRoot instead of the ReactDOM package

* remove another gating
2021-11-15 17:15:01 -05:00
Abhay Gupta
ee8f146a61 Proof of Concept for E2E tests using playwright (#22754) 2021-11-15 16:44:45 -05:00
Andrew Clark
96ca8d9155 Allow publishing with beta tag (#22768) 2021-11-15 10:43:40 -08:00
Andrew Clark
a52d76b877 Bump 18 from alpha to beta (#22766) 2021-11-15 10:26:30 -08:00
Andrew Clark
83564712b6 Move SuspenseList to experimental channel (#22765)
There's more work to be done to implement this correctly on the server,
so we're going to wait to release it until an 18.x minor.
2021-11-15 10:12:56 -08:00
MalikIdreesHasanKhan
489b4bdcca Fixed typos (#22763)
* Fixed typos

* Update ReactFiberWorkLoop.new.js

* Update ReactFiberWorkLoop.old.js
2021-11-15 12:31:35 -05:00
Brijesh Prasad
d4144e6e54 fix : grammatical typo for test description (#22764)
* fix : grammatical typo for test description

* fix linting issues
2021-11-15 11:44:48 -05:00