Commit Graph
3790 Commits
Author SHA1 Message Date
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
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
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
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 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
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
Mert Ciflikli 200415c91c fix typos (#22288) 2021-11-15 10:59:35 -05:00
Han Han 0b329511b9 chore: fix comment typo (#22657) 2021-11-15 10:58:30 -05:00
180909 e6f60d2add fix typos (#22715) 2021-11-15 10:58:21 -05:00
Sebastian Silbermann f86cd5408b devtools: dont restore profiling data if we're profling (#22753) 2021-11-15 10:46:17 -05:00
Ricky c0c71a8685 Re-enable useMutableSource in internal RN (#22750) 2021-11-12 16:54:59 -05:00
Brian Vaughn cb11155c86 Add runtime type checks around module boundary code (#22748) 2021-11-12 10:03:41 -05:00
Brian Vaughn 56efc65e58 DevTools should properly report re-renders due to (use)context changes (#22746)
Note that this only fixes things for newer versions of React (e.g. 18 alpha). Older versions will remain broken because there's not a good way to read the most recent context value for a location in the tree after render has completed. This is because React maintains a stack of context values during render, but by the time DevTools is called– render has finished and the stack is empty.
2021-11-11 14:22:22 -05:00
Brian Vaughn a44a7a2a3f Filter empty commits (all Fibers bailed out) from Profiler (#22745) 2021-11-11 10:35:16 -05:00
Brian Vaughn e0aa5e205f Add Scheduling Profiler GK link to Timeline UI for FB build (#22730)
This is a constant source of confusion for FB engineers trying to figure out why Chrome profiling data does not have any React marks.
2021-11-09 16:10:48 -05:00
Dan Abramov a04f13d299 react-refresh@0.11.0 2021-11-09 20:23:32 +00:00
irinakkandWang Yilin ff9897d23e [React Refresh] support typescript namespace syntax (#22621)
* [React Refresh] support typescript namespace syntax

* [React Refresh] handle nested namespace

Co-authored-by: Wang Yilin <wang_yil@worksap.co.jp>
2021-11-09 20:22:19 +00:00
salazarm 0ddd69d122 Throw on hydration mismatch and force client rendering if boundary hasn't suspended within concurrent root (#22629)
* Throw on hydration mismatch

* remove debugger

* update error message

* update error message part2...

* fix test?

* test? :(

* tests 4real

* remove useRefAccessWarning gating

* split markSuspenseBoundary and getNearestBoundary

* also assert html is correct

* replace-fork

* also remove client render flag on suspend

* replace-fork

* fix mismerge????
2021-11-09 13:40:50 -05:00
Dan Abramov c3f34e4beb eslint-plugin-react-hooks@4.3.0 2021-11-09 13:58:55 +00:00
Dan Abramov 827021c4e3 Changelog for eslint-plugin-react-hooks@4.3.0 2021-11-09 13:55:27 +00:00
Yash Joshi 2b77ab26ad fix(devtools): accept json file in import fileinput (#22717) 2021-11-08 16:35:35 -05:00
Yash Joshi 2db6d6a5a7 fix(devtools): expose css vars to reach-ui portal components (#22716) 2021-11-08 15:17:22 -05:00
Brian Vaughn 99a73ac670 Timeline: Improved snapshot view (#22706) 2021-11-08 12:28:33 -05:00
Sebastian Silbermann ee069065db devtools: Display root type for root updates in "what caused this update?" (#22599) 2021-11-05 11:58:35 -04:00
Konstantin Popov 54f6ae9b1c Fix small typos (#22701) 2021-11-04 19:49:06 -04:00
Brian Vaughn 13455d26d1 Cleaned up remaining "scheduling profiler" references in DevTools (#22696) 2021-11-04 11:40:45 -04:00
Brian Vaughn 8ca3f567bc Fix module-boundary wrappers (#22688) 2021-11-04 10:40:35 -04:00
Brian Vaughn 1bf6deb865 Renamed packages/react-devtools-scheduling-profiler to packages/react-devtools-timeline (#22691) 2021-11-04 10:02:06 -04:00
Brian Vaughn 51c558aeb6 Rename (some) "scheduling profiler" references to "timeline" (#22690) 2021-11-03 15:10:29 -04:00
EzzAkandBrian Vaughn 255221c869 [DevTools] Add open in editor for fb (#22649)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2021-11-03 11:27:30 -04:00
Andrew Clark 00ced1e2b7 Fix useId in strict mode (#22681)
* Fix: useId in strict mode

In strict mode, `renderWithHooks` is called twice to flush out
side effects.

Modying the tree context (`pushTreeId` and `pushTreeFork`) is effectful,
so before this fix, the tree context was allocating two slots for a
materialized id instead of one.

To address, I lifted those calls outside of `renderWithHooks`. This
is how I had originally structured it, and it's how Fizz is structured,
too. The other solution would be to reset the stack in between the calls
but that's also a bit weird because we usually only ever reset the
stack during unwind or complete.

* Add test for render phase updates

Noticed this while fixing the previous bug
2021-11-02 17:59:17 -07:00
Brian Vaughn 9fb3442250 Fix DevTools advanced tooltip display conditional check (#22669) 2021-11-02 11:02:45 -04:00
Abhay Gupta 3fcd81dd1c Improved workers filenames in devtools-inline (#22676) 2021-11-02 10:30:37 -04:00
Andrew Clark 5cccacd131 Upgrade useId to alpha channel (#22674) 2021-11-01 15:26:42 -07:00
Andrew Clark 75f3ddebfa Remove experimental useOpaqueIdentifier API (#22672)
useId is the updated version of this API.
2021-11-01 15:02:39 -07:00
Brian Vaughn 8c4a05b8fb Remove @flow pragma comment from module registration start/stop templates (#22670) 2021-11-01 17:46:09 -04:00
Andrew Clark ebf9ae8579 useId (#22644)
* Add useId to dispatcher

* Initial useId implementation

Ids are base 32 strings whose binary representation corresponds to the
position of a node in a tree.

Every time the tree forks into multiple children, we add additional bits
to the left of the sequence that represent the position of the child
within the current level of children.

    00101       00010001011010101
    ╰─┬─╯       ╰───────┬───────╯
  Fork 5 of 20       Parent id

The leading 0s are important. In the above example, you only need 3 bits
to represent slot 5. However, you need 5 bits to represent all the forks
at the current level, so we must account for the empty bits at the end.

For this same reason, slots are 1-indexed instead of 0-indexed.
Otherwise, the zeroth id at a level would be indistinguishable from
its parent.

If a node has only one child, and does not materialize an id (i.e. does
not contain a useId hook), then we don't need to allocate any space in
the sequence. It's treated as a transparent indirection. For example,
these two trees produce the same ids:

<>                          <>
  <Indirection>               <A />
    <A />                     <B />
  </Indirection>            </>
  <B />
</>

However, we cannot skip any materializes an id. Otherwise, a parent id
that does not fork would be indistinguishable from its child id. For
example, this tree does not fork, but the parent and child must have
different ids.

<Parent>
  <Child />
</Parent>

To handle this scenario, every time we materialize an id, we allocate a
new level with a single slot. You can think of this as a fork with only
one prong, or an array of children with length 1.

It's possible for the the size of the sequence to exceed 32 bits, the
max size for bitwise operations. When this happens, we make more room by
converting the right part of the id to a string and storing it in an
overflow variable. We use a base 32 string representation, because 32 is
the largest power of 2 that is supported by toString(). We want the base
to be large so that the resulting ids are compact, and we want the base
to be a power of 2 because every log2(base) bits corresponds to a single
character, i.e. every log2(32) = 5 bits. That means we can lop bits off
the end 5 at a time without affecting the final result.

* Incremental hydration

Stores the tree context on the dehydrated Suspense boundary's state
object so it resume where it left off.

* Add useId to react-debug-tools

* Add selective hydration test

Demonstrates that selective hydration works and ids are preserved even
after subsequent client updates.
2021-11-01 13:30:44 -07:00