Commit Graph

15676 Commits

Author SHA1 Message Date
acdlite 2c5d055496 Lower Suspense throttling heuristic to 300ms (#26803)
Now that the throttling mechanism applies more often, we've decided to
lower this a tad to ensure it's not noticeable. The idea is it should be
just large enough to prevent jank when lots of different parts of the UI
load in rapid succession, but not large enough to make the UI feel
sluggish. There's no perfect number, it's just a heuristic.

DiffTrain build for [f8de255e94](https://github.com/facebook/react/commit/f8de255e94540f9018d8196b3a34da500707c39b)
2023-05-16 20:05:29 +00:00
acdlite 7b59f84660 Fix Suspense throttling mechanism (#26802)
The throttling mechanism for fallbacks should apply to both their
appearance _and_ disappearance.

This was mostly addressed by #26611. See that PR for additional context.

However, a flaw in the implementation is that we only update the the
timestamp used for throttling when the fallback initially appears. We
don't update it when the real content pops in. If lots of content in
separate Suspense trees loads around the same time, you can still get
jank.

The issue is fixed by updating the throttling timestamp whenever the
visibility of a fallback changes. Not just when it appears.

DiffTrain build for [4bfcd02b2c](https://github.com/facebook/react/commit/4bfcd02b2cebcb390f5aff0d7747c60a55012d5d)
2023-05-16 19:09:44 +00:00
sophiebits 646a30e8a1 Fix uSES hydration in strict mode (#26791)
Previously, we'd call and use getSnapshot on the second render resulting
in `Warning: Text content did not match. Server: "Nay!" Client: "Yay!"`
and then `Error: Text content does not match server-rendered HTML.`.

Fixes #26095. Closes #26113. Closes #25650.

---------

Co-authored-by: eps1lon <silbermann.sebastian@gmail.com>

DiffTrain build for [4cd7065665](https://github.com/facebook/react/commit/4cd7065665ea2cf33c306265c8d817904bb401ca)
2023-05-12 21:22:56 +00:00
kassens d08f005d08 [www] reduce dynamic SchedulerFeatureFlags (#26617)
For these values we're not using dynamic values. We can statically
compile in the values we're running.

DiffTrain build for [df12d7eac4](https://github.com/facebook/react/commit/df12d7eac40c87bd5fdde0aa5a739bce9e7dce27)
2023-05-10 21:32:07 +00:00
kassens 3df08cb0ac Flow upgrade to 0.205.1 (#26796)
Just a small upgrade to keep us current and remove unused suppressions
(probably fixed by some upgrade since).

- `*` is no longer allowed and has been an alias for `any` for a while
now.

DiffTrain build for [fda1f0b902](https://github.com/facebook/react/commit/fda1f0b902b527089fe5ae7b3aa573c633166ec9)
2023-05-09 14:53:56 +00:00
sammy-SC c16551253d Use native scheduler if defined in global scope (#26554)
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

DiffTrain build for [b00e27342d](https://github.com/facebook/react/commit/b00e27342d6ff0f2a3a57b8e1edf66290d27cf07)
2023-05-05 13:08:26 +00:00
sebmarkbage 4707842f6a [Flight] Progressively Enhanced Server Actions (#26774)
This automatically exposes `$$FORM_ACTIONS` on Server References coming
from Flight. So that when they're used in a form action, we can encode
the ID for the server reference as a hidden field or as part of the name
of a button.

If the Server Action is a bound function it can have complex data
associated with it. In this case this additional data is encoded as
additional form fields.

To process a POST on the server there's now a `decodeAction` helper that
can take one of these progressive posts from FormData and give you a
function that is prebound with the correct closure and FormData so that
you can just invoke it.

I updated the fixture which now has a "Server State" that gets
automatically refreshed. This also lets us visualize form fields.
There's no "Action State" here for showing error messages that are not
thrown, that's still up to user space.

DiffTrain build for [aef7ce5547](https://github.com/facebook/react/commit/aef7ce5547c9489dc48e31f69b002cd17206e0cb)
2023-05-03 22:43:04 +00:00
sebmarkbage 399d6ad8d6 [Fizz] Gracefully handle suspending in DOM configs (#26768)
E.g. if we suspend (throw a promise) in pushStartInstance today we might
have already pushed some chunks (or even child segments potentially). We
should revert back to where we were.

This doesn't usually happen because when we suspend in a component it
doesn't write anything itself, it'll always defer to som host instance
to do the writing.

There was a todo about this already but I'm not 100% sure it's always
safe when suspending. It should be safe when suspending just regularly
because it's just a noop. We might not even want "throwing a promise" in
this mechanism to be supported longer term but for now that's how a
suspend in internals.

DiffTrain build for [c10010a6a0](https://github.com/facebook/react/commit/c10010a6a00911fe99452bc561dd47c3e15f4eb8)
2023-05-03 22:19:57 +00:00
sebmarkbage a746b8028a [Fizz] Check for nullish values on ReactCustomFormAction (#26770)
Usually we don't have to do this since we only set these in the loop but
the ReactCustomFormAction props are optional so they might be undefined.

Also moved it to a general type since it's a semi-public API.

DiffTrain build for [fa7a447b9c](https://github.com/facebook/react/commit/fa7a447b9ce5a4f0be592fc2946380b0fa3b29c0)
2023-05-03 18:40:34 +00:00
acdlite 098e6fd1b6 useOptimisticState -> useOptimistic (#26772)
Drop the "state". Just "useOptimistic". It's cleaner.

This is still an experimental API. May not be the final name.

DiffTrain build for [b7972822b5](https://github.com/facebook/react/commit/b7972822b5887d05ae772ef757a453265b4b7aec)
2023-05-03 18:31:56 +00:00
sebmarkbage 0b3882cf21 [Fizz] Allow an action provide a custom set of props to use for progressive enhancement (#26749)
Stacked on top of #26735.

This allows a framework to add a `$$FORM_ACTION` property to a function.
This lets the framework return a set of props to use in place of the
function but only during SSR. Effectively, this lets you implement
progressive enhancement of form actions using some other way instead of
relying on the replay feature.

This will be used by RSC on Server References automatically by
convention in a follow up, but this mechanism can also be used by other
frameworks/libraries.

DiffTrain build for [559e83aebb](https://github.com/facebook/react/commit/559e83aebb2026035d47aa0ebf842f78d4cd6757)
2023-05-01 20:06:06 +00:00
sebmarkbage 6476ee0531 Allow forms to skip hydration of hidden inputs (#26735)
This allows us to emit extra ephemeral data that will only be used on
server rendered forms.

First I refactored the shouldSkip functions to now just do that work
inside the canHydrate methods. This makes the Config bindings a little
less surface area but it also helps us optimize a bit since we now can
look at the code together and find shared paths.

canHydrate returns the instance if it matches, that used to just be
there to refine the type but it can also be used to just return a
different instance later that we find. If we don't find one, we'll bail
out and error regardless so no need to skip past anything.

DiffTrain build for [67f4fb0213](https://github.com/facebook/react/commit/67f4fb02130b1fe1856289e3b66bb0b8cca57ff7)
2023-05-01 19:41:06 +00:00
gnoff cae0d1b52f [Fizz] Encode external fizz runtime into chunks eagerly (#26752)
in https://github.com/facebook/react/pull/26738 we added nonce to the
ResponseState. Initially it was used in a variety of places but the
version that got merged only included it with the external fizz runtime.
This PR updates the config for the external fizz runtime so that the
nonce is encoded into the script chunks at request creation time.

The rationale is that for live-requests, streaming is more likely than
not so doing the encoding work at the start is better than during flush.
For cases such as SSG where the runtime is not required the extra
encoding is tolerable (not a live request). Bots are an interesting case
because if you want fastest TTFB you will end up requiring the runtime
but if you are withholding until the stream is done you have already
sacrificed fastest TTFB and the marginal slowdown of the extraneous
encoding is hopefully neglibible

I'm writing this so later if we learn that this tradeoff isn't worth it
we at least understand why I made the change in the first place.

DiffTrain build for [8ea96ef84d](https://github.com/facebook/react/commit/8ea96ef84d8f08ed1846dec9e8ed20d2225db0d3)
2023-05-01 17:55:35 +00:00
acdlite 655915c681 Implement experimental_useOptimisticState (#26740)
This adds an experimental hook tentatively called useOptimisticState.
(The actual name needs some bikeshedding.)

The headline feature is that you can use it to implement optimistic
updates. If you set some optimistic state during a transition/action,
the state will be automatically reverted once the transition completes.

Another feature is that the optimistic updates will be continually
rebased on top of the latest state.

It's easiest to explain with examples; we'll publish documentation as
the API gets closer to stabilizing. See tests for now.

Technically the use cases for this hook are broader than just optimistic
updates; you could use it implement any sort of "pending" state, such as
the ones exposed by useTransition and useFormStatus. But we expect
people will most often reach for this hook to implement the optimistic
update pattern; simpler cases are covered by those other hooks.

DiffTrain build for [491aec5d61](https://github.com/facebook/react/commit/491aec5d6113ce5bae7c10966bc38a4a8fc091a8)
2023-05-01 17:24:18 +00:00
gnoff 0f3ca2b230 Add nonce support to bootstrap scripts and external runtime (#26738)
Adds support for nonce on `bootstrapScripts`, `bootstrapModules` and the external fizz runtime

DiffTrain build for [9545e4810c](https://github.com/facebook/react/commit/9545e4810c2dc8922f575b6d8f726503a7345d0c)
2023-05-01 16:23:49 +00:00
gnoff 59f00e19a3 Preinits should support a nonce option (#26744)
Currently there is no way to provide a nonce when using
`ReactDOM.preinit(..., { as: 'script' })`

This PR adds `nonce?: string` as an option

While implementing this PR I added a test to also show you can pass
`integrity`. This test isn't directly related to the nonce change.

DiffTrain build for [b12bea62d9](https://github.com/facebook/react/commit/b12bea62d9cfd9a925f28cb2c93daeda3865a64e)
2023-04-28 23:02:37 +00:00
josephsavona db78d9be34 Handle line endings correctly on Windows in build script for RN (#26727)
## Summary

We added some post-processing in the build for RN in #26616 that broke
for users on Windows due to how line endings were handled to the regular
expression to insert some directives in the docblock. This fixes that
problem, reported in #26697 as well.

## How did you test this change?

Verified files are still built correctly on Mac/Linux. Will ask for help
to test on Windows.

DiffTrain build for [f87e97a0a6](https://github.com/facebook/react/commit/f87e97a0a67fa7cfd7e6f2ec985621c0e825cb23)
2023-04-25 22:05:15 +00:00
kassens 6c615dc833 Squash of #26573, #26580, #26583, #26594, #26595, #26596, #26627
- Refactor some controlled component stuff (#26573)
- Don't update textarea defaultValue and input checked unnecessarily (#26580)
- Diff properties in the commit phase instead of generating an update payload (#26583)
- Move validation of text nesting into ReactDOMComponent  (#26594)
- Remove initOption special case (#26595)
- Use already extracted values instead of reading off props for controlled components (#26596)
- Fix input tracking bug (#26627)

DiffTrain build for [ded4a785b875d384f78efa28279550d86d93f54f](https://github.com/facebook/react/commit/ded4a785b875d384f78efa28279550d86d93f54f)
2023-04-21 18:37:22 +00:00
kassens dccdf22b11 Refactor some controlled component stuff (#26573)
This is mainly renaming some stuff. The behavior change is
hasOwnProperty to nullish check.

I had a bigger refactor that was a dead-end but might as well land this
part and see if I can pick it up later.

DiffTrain build for [e48e771805c44929e0beb6fa138822a20765a3aa](https://github.com/facebook/react/commit/e48e771805c44929e0beb6fa138822a20765a3aa)
2023-04-21 14:09:07 +00:00
kassens 6433b78fee Clean up discrete event replaying (#26558)
This reverts commit cc958d2b1b.

DiffTrain build for [7ecfd6dc036fd923e7bdfd090e0956b1eca4323a](https://github.com/facebook/react/commit/7ecfd6dc036fd923e7bdfd090e0956b1eca4323a)
2023-04-20 18:40:30 +00:00
kassens f504564195 Remove no-fallthrough lint suppressions (#26553)
This reverts commit 5f0684807e.

DiffTrain build for [6bb84216807f5386d8a83baf9ee464358a68c7bd](https://github.com/facebook/react/commit/6bb84216807f5386d8a83baf9ee464358a68c7bd)
2023-04-20 18:31:04 +00:00
kassens 3f62582404 Put common aliases in Map/Set instead of switch over strings (#26551)
This reverts commit cb3fb01cc3.

DiffTrain build for [1ef9912cc096fa471019a54eff4999b36856288c](https://github.com/facebook/react/commit/1ef9912cc096fa471019a54eff4999b36856288c)
2023-04-20 17:09:08 +00:00
kassens 702cd33bd7 Remove findInstanceBlockingEvent unused parameters (#26534)
This reverts commit 682e67edd4.

DiffTrain build for [90fa6be2509f68fa05897324e6adbab57de30c0f](https://github.com/facebook/react/commit/90fa6be2509f68fa05897324e6adbab57de30c0f)
2023-04-20 17:02:20 +00:00
kassens 008dc81da7 Refactor DOM Bindings Completely Off of DOMProperty Meta Programming (#26546)
This reverts commit f41ddb6645.

DiffTrain build for [f506c332bbece40ca884cdb1f81345732ab0d3d3](https://github.com/facebook/react/commit/f506c332bbece40ca884cdb1f81345732ab0d3d3)
2023-04-20 15:54:55 +00:00
kassens 79869b0f78 Rename ReactServerFormatConfig to ReactFizzConfig (#26591)
This reverts commit 5988c2fee8.

DiffTrain build for [0108a62d6bed06f836ba904273541b74074806ca](https://github.com/facebook/react/commit/0108a62d6bed06f836ba904273541b74074806ca)
2023-04-20 15:39:59 +00:00
kassens 6325f82838 Implements wiring for Flight to have it's own "HostConfig" (#26590)
This reverts commit 9429ec9a83.

DiffTrain build for [cdf4588242e1dc0c9b29f7539d9ae97d216d03d4](https://github.com/facebook/react/commit/cdf4588242e1dc0c9b29f7539d9ae97d216d03d4)
2023-04-20 15:32:52 +00:00
kassens 1f49af93f1 Fix: Move destroy field to shared instance object (#26561)
This reverts commit d41e5c2c3c.

DiffTrain build for [1d3ffd9d9addb4aa0988b92ee6917c07c3c261ae](https://github.com/facebook/react/commit/1d3ffd9d9addb4aa0988b92ee6917c07c3c261ae)
2023-04-20 15:27:55 +00:00
kassens 38b20a32d3 Fix suspense replaying forward refs (#26535)
This reverts commit adac7b1e8d.

DiffTrain build for [2f18eb0ac63fdcaed3f1d4e3c375a559a552c09a](https://github.com/facebook/react/commit/2f18eb0ac63fdcaed3f1d4e3c375a559a552c09a)
2023-04-20 15:22:14 +00:00
kassens 7d661b0f87 Fix logic around attribute seralization (#26526)
This reverts commit ea499ef928.

DiffTrain build for [66dc44e7760d0f75b6845b7fa71f2f1e4e5f20d3](https://github.com/facebook/react/commit/66dc44e7760d0f75b6845b7fa71f2f1e4e5f20d3)
2023-04-20 15:09:58 +00:00
kassens 91db3a057d Revert "Cleanup enableSyncDefaultUpdate flag (#26236)" (#26528)
This reverts commit c6baac38b4.

DiffTrain build for [a7b421fb4e0d0aa29aa2c3436c7c8756f2bae2d2](https://github.com/facebook/react/commit/a7b421fb4e0d0aa29aa2c3436c7c8756f2bae2d2)
2023-04-20 00:49:09 +00:00
kassens 34cf2eff9f Revert "Revert "[Float] Suspend unstyled content for up to 1 minute (#26532)""
This reverts commit 314f7d3a3c.

DiffTrain build for [7eca7179173c91d3a3501140df0afd45886d1769](https://github.com/facebook/react/commit/7eca7179173c91d3a3501140df0afd45886d1769)
2023-04-19 23:16:43 +00:00
kassens d05978bc8f Revert "Revert "Allow transitions to interrupt Suspensey commits (#26531)""
This reverts commit cfd9d8c73f.

DiffTrain build for [f9231793c57da481cc2030b77f9806cd4dc156f0](https://github.com/facebook/react/commit/f9231793c57da481cc2030b77f9806cd4dc156f0)
2023-04-19 21:40:43 +00:00
kassens 4771ede2e9 Revert "Revert "act: Move didScheduleLegacyUpdate to ensureRootIsScheduled (#26552)""
This reverts commit 7b6e17c8bb.

DiffTrain build for [d08b6cf47b8b4c5bcf8e393fe7b42a896be1b44c](https://github.com/facebook/react/commit/d08b6cf47b8b4c5bcf8e393fe7b42a896be1b44c)
2023-04-19 19:33:44 +00:00
Jan Kassens 6503387506 Update REVISION again 2023-04-19 14:16:38 -04:00
Jan Kassens 33386c26c4 Update REVISION 2023-04-19 14:16:36 -04:00
Jan Kassens 0cb176e5f3 Update REVISION 2023-04-19 13:59:08 -04:00
kassens 9cd51d0053 [actions] commit from special branches iff they exist (#26673)
This creates 2 special branches. If these special branches exist, we'll
commit build artifacts from these branches, main otherwise.

DiffTrain build for [70bda41a01e3d1b785f658ea069f6c505e684686](https://github.com/facebook/react/commit/70bda41a01e3d1b785f658ea069f6c505e684686)
2023-04-19 16:21:16 +00:00
sebmarkbage 80fdf65a7f Switching checked to null should leave the current value (#26667)
I accidentally made a behavior change in the refactor. It turns out that
when switching off `checked` to an uncontrolled component, we used to
revert to the concept of "initialChecked" which used to be stored on
state.

When there's a diff to this computed prop and the value of props.checked
is null, then we end up in a case where it sets `checked` to
`initialChecked`:

https://github.com/facebook/react/blob/5cbe6258bc436b1683080a6d978c27849f1d9a22/packages/react-dom-bindings/src/client/ReactDOMInput.js#L69

Since we never changed `initialChecked` and it's not relevant if
non-null `checked` changes value, the only way this "change" could
trigger was if we move from having `checked` to having null.

This wasn't really consistent with how `value` works, where we instead
leave the current value in place regardless. So this is a "bug fix" that
changes `checked` to be consistent with `value` and just leave the
current value in place. This case should already have a warning in it
regardless since it's going from controlled to uncontrolled.

Related to that, there was also another issue observed in
https://github.com/facebook/react/pull/26596#discussion_r1162295872 and
https://github.com/facebook/react/pull/26588

We need to atomically apply mutations on radio buttons. I fixed this by
setting the name to empty before doing mutations to value/checked/type
in updateInput, and then set the name to whatever it should be. Setting
the name is what ends up atomically applying the changes.

---------

Co-authored-by: Sophie Alpert <git@sophiebits.com>

DiffTrain build for [1f248bdd71](https://github.com/facebook/react/commit/1f248bdd7199979b050e4040ceecfe72dd977fd1)
2023-04-19 15:51:39 +00:00
sophiebits 5aa773a9d9 [Flight] Serialize Date (#26622)
This is kind of annoying because Date implements toJSON so
JSON.stringify turns it into a string before calling our replacer
function.

DiffTrain build for [c6db19f9cd](https://github.com/facebook/react/commit/c6db19f9cdec34bca3625a483a2f85181193b885)
2023-04-19 03:56:59 +00:00
sophiebits db190e0705 Fix input tracking bug (#26627)
In
https://github.com/facebook/react/pull/26573/commits/2019ddc75f448292ffa6429d7625514af192631b,
we changed to set .defaultValue before .value on updates. In some cases,
setting .defaultValue causes .value to change, and since we only set
.value if it has the wrong value, this resulted in us not assigning to
.value, which resulted in inputValueTracking not knowing the right
value. See new test added.

My fix here is to (a) move the value setting back up first and (b)
narrowing the fix in the aforementioned PR to newly remove the value
attribute only if it defaultValue was previously present in props.

The second half is necessary because for types where the value property
and attribute are indelibly linked (hidden checkbox radio submit image
reset button, i.e. spec modes default or default/on from
https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default),
we can't remove the value attribute after setting .value, because that
will undo the assignment we just did! That is, not having (b) makes all
of those types fail to handle updating props.value.

This code is incredibly hard to think about but I think this is right
(or at least, as right as the old code was) because we set .value here
only if the nextProps.value != null, and we now remove defaultValue only
if lastProps.defaultValue != null. These can't happen at the same time
because we have long warned if value and defaultValue are simultaneously
specified, and also if a component switches between controlled and
uncontrolled.

Also, it fixes the test in https://github.com/facebook/react/pull/26626.

DiffTrain build for [b433c379d5](https://github.com/facebook/react/commit/b433c379d55d9684945217c7d375de1082a1abb8)
2023-04-18 17:54:42 +00:00
sophiebits b679adf497 [Flight] Fix style nit from #26623 (#26629)
Maybe this is faster.
https://github.com/facebook/react/pull/26623#discussion_r1167053174

DiffTrain build for [2bfe4b246f](https://github.com/facebook/react/commit/2bfe4b246f58d1f8d357f984fba9a8aa1fa79c73)
2023-04-14 16:54:36 +00:00
sophiebits 6f02a016b0 [Flight] Serialize weird numbers (#26623)
DiffTrain build for [ab2385fa38](https://github.com/facebook/react/commit/ab2385fa388f3d4ebc0b1a9f5a747c82e4aa82ed)
2023-04-14 16:33:48 +00:00
acdlite cda4f89f40 Synchronously flush the transition lane scheduled in a popstate event (#26025)
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open
`chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

Browsers restore state like forms and scroll position right after the
popstate event. To make sure the page work as expected on back or
forward button, we need to flush transitions scheduled in a popstate
synchronously, and only yields if it suspends.
This PR adds a new HostConfig method to check if `window.event ===
'popstate'`, and `scheduleMicrotask` if a transition is scheduled in a
`PopStateEvent`.

## How did you test this change?

yarn test

DiffTrain build for [d121c67004](https://github.com/facebook/react/commit/d121c67004a2e6b0bb5d341843663ef213f64863)
2023-04-13 19:26:30 +00:00
acdlite 94c515f879 Remove revertRemovalOfSiblingPrerendering killswitch (#26549)
removal of sibling prerendering has been rolled out at Meta. We can
delete the flag now.

DiffTrain build for [7b0642bb98](https://github.com/facebook/react/commit/7b0642bb989ec659c6c9891ea16daa0420caab4d)
2023-04-13 01:10:13 +00:00
acdlite 62dabe5299 Throttle retries even if everything has loaded (#26611)
If a Suspense fallback is shown, and the data finishes loading really
quickly after that, we throttle the content from appearing for 500ms to
reduce thrash.

This already works for successive fallback states (like if one fallback
is nested inside another) but it wasn't being applied to the final step
in the sequence: if there were no more unresolved Suspense boundaries in
the tree, the content would appear immediately.

This fixes the throttling behavior so that it applies to all renders
that are the result of suspended data being loaded. (Our internal jargon
term for this is a "retry".)

DiffTrain build for [8256781fdf](https://github.com/facebook/react/commit/8256781fdf3ae1947a7f27ddc78ae11b9989c2cd)
2023-04-13 00:30:30 +00:00
sebmarkbage bdb1083dfa Use already extracted values instead of reading off props for controlled components (#26596)
Since `props.x` is a possibly megamorphic access, it can be slow to
access and trigger recompilation.

When we are looping over the props and pattern matching every key,
anyway, we've already done this work. We can just reuse the same value
by stashing it outside the loop in the stack.

This only makes sense for updates in diffInCommitPhase since otherwise
we don't have the full set of props in that loop.

We also have to be careful not to skip over equal values since we need
to extract them anyway.

DiffTrain build for [6b90976bc1](https://github.com/facebook/react/commit/6b90976bc10f325146b193286435a4b5015ef605)
2023-04-11 17:37:45 +00:00
sebmarkbage fa65896ebf Remove initOption special case (#26595)
This traces back to https://github.com/facebook/react/pull/6449 and then
another before that.

I think that back then we favored the property over the attribute, and
setting the property wouldn't be enough. However, the default path for
these are now using attributes if we don't special case it. So we don't
need it.

The only difference is that we currently have a divergence for
symbol/function behavior between controlled values that use the
getToStringValue helpers which treat them as empty string, where as
everywhere else they're treated as null/missing.

Since this comes with a warning and is a weird error case, it's probably
fine to change.

DiffTrain build for [343a45ffa4](https://github.com/facebook/react/commit/343a45ffa48065e60699bbe68f82d7b62fa02840)
2023-04-11 16:44:01 +00:00
acdlite e2c8a46604 Delete unused eventTimes Fiber field (#26599)
DiffTrain build for [58742c21b8](https://github.com/facebook/react/commit/58742c21b8c3237e8b66c7df4e200504846a01ae)
2023-04-11 12:28:04 +00:00
acdlite be590ddd8f Remove JND delay for non-transition updates (#26597)
Updates that are marked as part of a transition are allowed to block a
render from committing. Generally, other updates cannot — however,
there's one exception that's leftover from a previous iteration of our
Suspense architecture. If an update is not the result of a known urgent
event type — known as "Default" updates — then we allow it to suspend
briefly, as long as the delay is short enough that the user won't
notice. We refer to this delay as a "Just Noticable Difference" (JND)
delay. To illustrate, if the user has already waited 400ms for an update
to be reflected on the screen, the theory is that they won't notice if
you wait an additional 100ms. So React can suspend for a bit longer in
case more data comes in. The longer the user has already waited, the
longer the JND.

While we still believe this theory is sound from a UX perspective, we no
longer think the implementation complexity is worth it. The main thing
that's changed is how we handle Default updates. We used to render
Default updates concurrently (i.e. they were time sliced, and were
scheduled with postTask), but now they are blocking. Soon, they will
also be scheduled with rAF, too, which means by the end of the next rAF,
they will have either finished rendering or the main thread will be
blocked until they do. There are various motivations for this but part
of the rationale is that anything that can be made non-blocking should
be marked as a Transition, anyway, so it's not worth adding
implementation complexity to Default.

This commit removes the JND delay for Default updates. They will now
commit immediately once the render phase is complete, even if a
component suspends.

DiffTrain build for [0b931f90e8](https://github.com/facebook/react/commit/0b931f90e8964183f08ac328e7350d847abb08f9)
2023-04-11 04:24:45 +00:00
sebmarkbage d7b570e955 Move validation of text nesting into ReactDOMComponent (#26594)
Extract validateTextNesting from validateDOMNesting. We only need the
parent tag when validating text nodes. Then validate it in setProp.

DiffTrain build for [ac43bf6870](https://github.com/facebook/react/commit/ac43bf6870a15566507477a4504f22160835c8d3)
2023-04-11 01:48:08 +00:00