react/packages/react-reconciler/src
Sebastian Markbåge 9d111ffdfb
Serialize Promises through Flight (#26086)
This lets you pass Promises from server components to client components
and `use()` them there.

We still don't support Promises as children on the client, so we need to
support both. This will be a lot simpler when we remove the need to
encode children as lazy since we don't need the lazy encoding anymore
then.

I noticed that this test failed because we don't synchronously resolve
instrumented Promises if they're lazy. The second fix calls `.then()`
early to ensure that this lazy initialization can happen eagerly. ~It
felt silly to do this with an empty function or something, so I just did
the attachment of ping listeners early here. It's also a little silly
since they will ping the currently running render for no reason if it's
synchronously available.~ EDIT: That didn't work because a ping might
interrupt the current render. Probably need a bigger refactor.

We could add another extension but we've already taken a lot of
liberties with the Promise protocol. At least this is one that doesn't
need extension of the protocol as much. Any sub-class of promises could
do this.
2023-02-01 12:56:53 -05:00
..
__mocks__/scheduler [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
__tests__ Fix async test in React reconciler (#26087) 2023-02-01 09:59:41 +01:00
forks Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
DebugTracing.js [flow] enable enforce_local_inference_annotations (#25921) 2023-01-09 15:46:48 -05:00
MaxInts.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactCapturedValue.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactChildFiber.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactCurrentFiber.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactEventPriorities.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiber.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberAct.js Upgrade to Flow 0.196.3 (#25974) 2023-01-09 17:52:42 -05:00
ReactFiberBeginWork.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberCache.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberCacheComponent.js [flow] enable enforce_local_inference_annotations (#25921) 2023-01-09 15:46:48 -05:00
ReactFiberClassComponent.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberClassUpdateQueue.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberCommitWork.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberCompleteWork.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberComponentStack.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberConcurrentUpdates.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberContext.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberDevToolsHook.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberErrorDialog.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberErrorLogger.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberFlags.js Upgrade to Flow 0.196.3 (#25974) 2023-01-09 17:52:42 -05:00
ReactFiberHiddenContext.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberHooks.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberHostConfig.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoHydration.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoMicrotasks.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoMutation.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoPersistence.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoResources.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoScopes.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoSingletons.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostConfigWithNoTestSelectors.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactFiberHostContext.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberHotReloading.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberHydrationContext.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberLane.js Refactor: remove useless parameter (#25923) 2023-01-09 23:25:02 -05:00
ReactFiberLazyComponent.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberNewContext.js Don't warn about concurrently rendering contexts if we finished rendering (#22797) 2023-01-12 13:17:15 +01:00
ReactFiberOffscreenComponent.js Remove unused Flow suppressions (#25977) 2023-01-10 10:32:42 -05:00
ReactFiberReconciler.js [flow] enable exact_empty_objects (#25973) 2023-01-09 17:00:36 -05:00
ReactFiberRoot.js [flow] enable enforce_local_inference_annotations (#25921) 2023-01-09 15:46:48 -05:00
ReactFiberScope.js [flow] enable exact_empty_objects (#25973) 2023-01-09 17:00:36 -05:00
ReactFiberShellHydration.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberStack.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberSuspenseComponent.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberSuspenseContext.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberSyncTaskQueue.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberThenable.js Serialize Promises through Flight (#26086) 2023-02-01 12:56:53 -05:00
ReactFiberThrow.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberTracingMarkerComponent.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberTransition.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactFiberTreeContext.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberTreeReflection.js [flow] enable enforce_local_inference_annotations (#25921) 2023-01-09 15:46:48 -05:00
ReactFiberUnwindWork.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactFiberWorkLoop.js Upgrade prettier (#26081) 2023-01-31 08:25:05 -05:00
ReactHookEffectTags.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactInternalTypes.js ESLint upgrade to use hermes-eslint (#25915) 2022-12-20 14:27:01 -05:00
ReactMutableSource.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactPortal.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactPostPaintCallback.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactProfilerTimer.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactReconcilerConstants.js Remove Reconciler fork (2/2) (#25775) 2022-12-01 23:19:13 -05:00
ReactRootTags.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactStrictModeWarnings.js [flow] enable enforce_local_inference_annotations (#25921) 2023-01-09 15:46:48 -05:00
ReactTestSelectors.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactTypeOfMode.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
ReactWorkTags.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
Scheduler.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
clz32.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
getComponentNameFromFiber.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00