Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

double invoke test #1

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fecc288
[react devtools] Device storage support (#25452)
rbalicki2 Oct 25, 2022
1720405
[Float] fix coordination of resource identity and hydration (#25569)
gnoff Oct 27, 2022
09def59
[Float] handle noscript context for Resources (#25559)
gnoff Oct 27, 2022
28a574e
Try assigning fetch to globalThis if global assignment fails (#25571)
sebmarkbage Oct 27, 2022
cf3932b
Remove old react-fetch, react-fs and react-pg libraries (#25577)
sebmarkbage Oct 27, 2022
d2a0176
Detect and warn if use(promise) is wrapped with try/catch block (#25543)
acdlite Oct 28, 2022
5450dd4
Strict Mode: Reuse memoized result from first pass (#25583)
acdlite Oct 28, 2022
d2c0ab1
In work loop, add enum of reasons for suspending
acdlite Oct 24, 2022
952dfff
Split suspended work loop logic into separate functions
acdlite Oct 24, 2022
bdd3d08
Extract logic for detecting bad fallback to helper
acdlite Oct 24, 2022
2ac77aa
Clean up vestige of useOpaqueIdentifier (#25587)
acdlite Oct 30, 2022
765805b
Fix type check for null (#25595)
sebmarkbage Oct 31, 2022
ab075a2
Do not unmount layout effects on initial Offscreen mount (#25592)
sammy-SC Nov 1, 2022
6883d79
[ServerRenderer] Setup for adding data attributes streaming format (#…
mofeiZ Nov 1, 2022
36426e6
Allow uncached IO to stablize (#25561)
acdlite Nov 1, 2022
5f7ef8c
[Float] handle resource Resource creation inside svg context (#25599)
gnoff Nov 1, 2022
8e69bc4
Make host context use null as empty and only error in dev (#25609)
sebmarkbage Nov 1, 2022
4ea063b
refactor isHostResourceType to not receive the context from reconcile…
gnoff Nov 2, 2022
1a90262
Unwrap sync resolved thenables without suspending (#25615)
acdlite Nov 2, 2022
1a08f14
[ServerRenderer] Move fizz external runtime implementation to react-d…
mofeiZ Nov 3, 2022
df61e70
Remove check in renderDidSuspendDelayIfPossible (#25630)
acdlite Nov 3, 2022
4bd245e
Do not unmount layout effects if ancestor Offscreen is hidden (#25628)
sammy-SC Nov 4, 2022
18dff79
[DevTools] add support for HostSingleton & HostResource (#25616)
mondaychen Nov 7, 2022
1e3e30d
Fix useSyncExternalStore dropped update when state is dispatched in r…
pandaiolo Nov 8, 2022
d1e35c7
Don't disappear layout effects unnecessarily (#25660)
sammy-SC Nov 10, 2022
c54e354
[DevTools] bug fix for Hydrating fibers (#25663)
mondaychen Nov 11, 2022
e1dd0a2
Remove recoverable error when a sync update flows into a dehydrated b…
sebmarkbage Nov 16, 2022
c343f80
[react-float] feature detect getRootNode (#25689)
kassens Nov 16, 2022
355dd7d
Bump loader-utils from 2.0.0 to 2.0.4 in /fixtures/flight (#25694)
dependabot[bot] Nov 16, 2022
db8a3fc
Bump loader-utils from 1.4.0 to 1.4.2 in /fixtures/fizz (#25680)
dependabot[bot] Nov 16, 2022
d65b88d
Eagerly initialize an mutable object for instance.refs (#25696)
sebmarkbage Nov 16, 2022
07f46ec
Turn on key spread warning in jsx-runtime for everyone (#25697)
sebmarkbage Nov 16, 2022
6fb8133
Turn on string ref deprecation warning for everybody (not codemoddabl…
eps1lon Nov 17, 2022
7b17f7b
Enable warning for defaultProps on function components for everyone (…
sebmarkbage Nov 17, 2022
44c4e6f
Force unwind work loop during selective hydration (#25695)
acdlite Nov 17, 2022
9dfbd9f
use: Don't suspend if there are pending updates
acdlite Nov 3, 2022
4a2d86b
Don't reset work loop until stack is unwound
acdlite Nov 2, 2022
5eb78d0
Pass ThenableState to replaySuspendedUnitOfWork
acdlite Nov 2, 2022
4387d75
Allow more hooks to be added when replaying mount
acdlite Nov 3, 2022
33e3d28
Reuse hooks when replaying a suspended component
acdlite Nov 3, 2022
6b4c031
Check thenable instead of thenableState
acdlite Nov 3, 2022
f284d9f
Track ThenableState alongside other hooks
acdlite Nov 3, 2022
f31005d
Add SyncHydrationLane (#25698)
tyao1 Nov 17, 2022
b0a6f66
Test for double invoke effect of useLayoutEffect
kassens Nov 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check thenable instead of thenableState
Now that hook state is preserved while the work loop is suspended, we
don't need to track the thenable state in the work loop. We can track
it alongside the rest of the hook state.

Before deleting the thenable state variable from the work loop, I need
to remove the other places where it's referenced.

One of them is `isThenableStateResolved`. This grabs the last thenable
from the array and checks if it has resolved.

This was a pointless indirection anyway. The thenable is already stored
as `workInProgressThrownValue`. So we can check that directly.
  • Loading branch information
acdlite committed Nov 17, 2022
commit 6b4c0314e82e3e56a8af84f3af3c0822a950ad1f
10 changes: 3 additions & 7 deletions packages/react-reconciler/src/ReactFiberThenable.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ export function getThenableStateAfterSuspending(): ThenableState | null {
return state;
}

export function isThenableStateResolved(thenables: ThenableState): boolean {
const lastThenable = thenables[thenables.length - 1];
if (lastThenable !== undefined) {
const status = lastThenable.status;
return status === 'fulfilled' || status === 'rejected';
}
return true;
export function isThenableResolved(thenable: Thenable<mixed>): boolean {
const status = thenable.status;
return status === 'fulfilled' || status === 'rejected';
}

function noop(): void {}
Expand Down
10 changes: 3 additions & 7 deletions packages/react-reconciler/src/ReactFiberThenable.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ export function getThenableStateAfterSuspending(): ThenableState | null {
return state;
}

export function isThenableStateResolved(thenables: ThenableState): boolean {
const lastThenable = thenables[thenables.length - 1];
if (lastThenable !== undefined) {
const status = lastThenable.status;
return status === 'fulfilled' || status === 'rejected';
}
return true;
export function isThenableResolved(thenable: Thenable<mixed>): boolean {
const status = thenable.status;
return status === 'fulfilled' || status === 'rejected';
}

function noop(): void {}
Expand Down
15 changes: 6 additions & 9 deletions packages/react-reconciler/src/ReactFiberWorkLoop.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ import {
SuspenseException,
getSuspendedThenable,
getThenableStateAfterSuspending,
isThenableStateResolved,
isThenableResolved,
} from './ReactFiberThenable.new';
import {schedulePostPaintCallback} from './ReactPostPaintCallback';
import {
Expand Down Expand Up @@ -2204,24 +2204,20 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
break;
}
case SuspendedOnData: {
const thenable: Thenable<mixed> = (thrownValue: any);
if (workInProgressSuspendedThenableState !== null) {
const thenableState = workInProgressSuspendedThenableState;
if (isThenableStateResolved(thenableState)) {
if (isThenableResolved(thenable)) {
// The data resolved. Try rendering the component again.
workInProgressSuspendedReason = NotSuspended;
workInProgressThrownValue = null;
replaySuspendedUnitOfWork(
unitOfWork,
thrownValue,
thenableState,
);
replaySuspendedUnitOfWork(unitOfWork, thenable, thenableState);
break;
}
}

// The work loop is suspended on data. We should wait for it to
// resolve before continuing to render.
const thenable: Thenable<mixed> = (workInProgressThrownValue: any);
const onResolution = () => {
ensureRootIsScheduled(root, now());
};
Expand All @@ -2246,7 +2242,8 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
default: {
if (workInProgressSuspendedThenableState !== null) {
const thenableState = workInProgressSuspendedThenableState;
if (isThenableStateResolved(thenableState)) {
const thenable: Thenable<mixed> = (thrownValue: any);
if (isThenableResolved(thenable)) {
// The data resolved. Try rendering the component again.
workInProgressSuspendedReason = NotSuspended;
workInProgressThrownValue = null;
Expand Down
15 changes: 6 additions & 9 deletions packages/react-reconciler/src/ReactFiberWorkLoop.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ import {
SuspenseException,
getSuspendedThenable,
getThenableStateAfterSuspending,
isThenableStateResolved,
isThenableResolved,
} from './ReactFiberThenable.old';
import {schedulePostPaintCallback} from './ReactPostPaintCallback';
import {
Expand Down Expand Up @@ -2204,24 +2204,20 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
break;
}
case SuspendedOnData: {
const thenable: Thenable<mixed> = (thrownValue: any);
if (workInProgressSuspendedThenableState !== null) {
const thenableState = workInProgressSuspendedThenableState;
if (isThenableStateResolved(thenableState)) {
if (isThenableResolved(thenable)) {
// The data resolved. Try rendering the component again.
workInProgressSuspendedReason = NotSuspended;
workInProgressThrownValue = null;
replaySuspendedUnitOfWork(
unitOfWork,
thrownValue,
thenableState,
);
replaySuspendedUnitOfWork(unitOfWork, thenable, thenableState);
break;
}
}

// The work loop is suspended on data. We should wait for it to
// resolve before continuing to render.
const thenable: Thenable<mixed> = (workInProgressThrownValue: any);
const onResolution = () => {
ensureRootIsScheduled(root, now());
};
Expand All @@ -2246,7 +2242,8 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
default: {
if (workInProgressSuspendedThenableState !== null) {
const thenableState = workInProgressSuspendedThenableState;
if (isThenableStateResolved(thenableState)) {
const thenable: Thenable<mixed> = (thrownValue: any);
if (isThenableResolved(thenable)) {
// The data resolved. Try rendering the component again.
workInProgressSuspendedReason = NotSuspended;
workInProgressThrownValue = null;
Expand Down