2015-12-01 11:31:31 +08:00
|
|
|
/**
|
2018-09-08 06:11:23 +08:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-12-01 11:31:31 +08:00
|
|
|
*
|
2017-09-25 04:48:13 +08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-12-01 11:31:31 +08:00
|
|
|
*
|
2018-08-30 04:54:58 +08:00
|
|
|
* @flow strict
|
2015-12-01 11:31:31 +08:00
|
|
|
*/
|
|
|
|
|
|
2017-11-07 00:07:08 +08:00
|
|
|
export const enableUserTimingAPI = __DEV__;
|
2017-10-19 01:40:52 +08:00
|
|
|
|
2019-11-05 06:07:05 +08:00
|
|
|
// Helps identify side effects in render-phase lifecycle hooks and setState
|
|
|
|
|
// reducers by double invoking them in Strict Mode.
|
2018-01-26 06:30:53 +08:00
|
|
|
export const debugRenderPhaseSideEffectsForStrictMode = __DEV__;
|
|
|
|
|
|
Add stack unwinding phase for handling errors (#12201)
* Add stack unwinding phase for handling errors
A rewrite of error handling, with semantics that more closely match
stack unwinding.
Errors that are thrown during the render phase unwind to the nearest
error boundary, like before. But rather than synchronously unmount the
children before retrying, we restart the failed subtree within the same
render phase. The failed children are still unmounted (as if all their
keys changed) but without an extra commit.
Commit phase errors are different. They work by scheduling an error on
the update queue of the error boundary. When we enter the render phase,
the error is popped off the queue. The rest of the algorithm is
the same.
This approach is designed to work for throwing non-errors, too, though
that feature is not implemented yet.
* Add experimental getDerivedStateFromCatch lifecycle
Fires during the render phase, so you can recover from an error within the same
pass. This aligns error boundaries more closely with try-catch semantics.
Let's keep this behind a feature flag until a future release. For now, the
recommendation is to keep using componentDidCatch. Eventually, the advice will
be to use getDerivedStateFromCatch for handling errors and componentDidCatch
only for logging.
* Reconcile twice to remount failed children, instead of using a boolean
* Handle effect immediately after its thrown
This way we don't have to store the thrown values on the effect list.
* ReactFiberIncompleteWork -> ReactFiberUnwindWork
* Remove startTime
* Remove TypeOfException
We don't need it yet. We'll reconsider once we add another exception type.
* Move replay to outer catch block
This moves it out of the hot path.
2018-02-24 09:38:42 +08:00
|
|
|
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
|
|
|
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
|
|
|
export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
|
|
|
|
|
|
2018-01-20 01:36:46 +08:00
|
|
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
2019-03-28 07:30:49 +08:00
|
|
|
export const warnAboutDeprecatedLifecycles = true;
|
2018-01-20 01:36:46 +08:00
|
|
|
|
2018-05-11 06:25:32 +08:00
|
|
|
// Gather advanced timing metrics for Profiler subtrees.
|
2018-06-12 04:16:27 +08:00
|
|
|
export const enableProfilerTimer = __PROFILE__;
|
2018-05-11 06:25:32 +08:00
|
|
|
|
2018-09-14 05:23:16 +08:00
|
|
|
// Trace which interactions trigger each commit.
|
|
|
|
|
export const enableSchedulerTracing = __PROFILE__;
|
2018-08-18 00:16:05 +08:00
|
|
|
|
2019-10-16 06:09:19 +08:00
|
|
|
// SSR experiments
|
|
|
|
|
export const enableSuspenseServerRenderer = __EXPERIMENTAL__;
|
|
|
|
|
export const enableSelectiveHydration = __EXPERIMENTAL__;
|
2018-12-07 05:57:23 +08:00
|
|
|
|
2019-12-19 02:25:43 +08:00
|
|
|
// Flight experiments
|
|
|
|
|
export const enableChunksAPI = __EXPERIMENTAL__;
|
|
|
|
|
|
2018-12-07 05:57:23 +08:00
|
|
|
// Only used in www builds.
|
2018-12-18 08:50:38 +08:00
|
|
|
export const enableSchedulerDebugging = false;
|
2018-09-06 06:04:59 +08:00
|
|
|
|
2017-11-07 00:07:08 +08:00
|
|
|
// Only used in www builds.
|
|
|
|
|
export function addUserTimingListener() {
|
2018-09-12 23:56:04 +08:00
|
|
|
throw new Error('Not implemented.');
|
2017-11-07 00:07:08 +08:00
|
|
|
}
|
2018-09-13 02:29:23 +08:00
|
|
|
|
2019-03-12 07:39:49 +08:00
|
|
|
// Disable javascript: URL strings in href for XSS protection.
|
|
|
|
|
export const disableJavaScriptURLs = false;
|
|
|
|
|
|
2018-10-25 04:45:07 +08:00
|
|
|
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
|
|
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
2019-10-16 06:09:19 +08:00
|
|
|
export const exposeConcurrentModeAPIs = __EXPERIMENTAL__;
|
2018-11-16 05:36:52 +08:00
|
|
|
|
|
|
|
|
export const warnAboutShorthandPropertyCollision = false;
|
2019-02-26 07:00:39 +08:00
|
|
|
|
2019-06-28 08:11:11 +08:00
|
|
|
// Experimental React Flare event system and event components support.
|
2019-12-18 18:24:46 +08:00
|
|
|
export const enableDeprecatedFlareAPI = false;
|
2019-03-21 07:28:33 +08:00
|
|
|
|
2019-07-20 05:20:28 +08:00
|
|
|
// Experimental Host Component support.
|
|
|
|
|
export const enableFundamentalAPI = false;
|
|
|
|
|
|
2019-08-29 19:06:51 +08:00
|
|
|
// Experimental Scope support.
|
|
|
|
|
export const enableScopeAPI = false;
|
|
|
|
|
|
2019-04-08 03:02:34 +08:00
|
|
|
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
|
|
|
export const enableJSXTransformAPI = false;
|
2019-05-16 04:38:06 +08:00
|
|
|
|
2019-05-17 00:12:36 +08:00
|
|
|
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
2019-10-24 06:04:39 +08:00
|
|
|
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
|
2019-07-31 02:00:18 +08:00
|
|
|
export const warnAboutUnmockedScheduler = false;
|
2019-06-05 04:35:52 +08:00
|
|
|
|
2019-07-31 02:12:06 +08:00
|
|
|
// For tests, we flush suspense fallbacks in an act scope;
|
|
|
|
|
// *except* in some of our own tests, where we test incremental loading states.
|
|
|
|
|
export const flushSuspenseFallbacksInTests = true;
|
|
|
|
|
|
2019-07-24 08:13:46 +08:00
|
|
|
// Add a callback property to suspense to notify which promises are currently
|
|
|
|
|
// in the update queue. This allows reporting and tracing of what is causing
|
|
|
|
|
// the user to see a loading state.
|
2019-08-20 04:26:39 +08:00
|
|
|
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
|
|
|
// hydrated or deleted.
|
2019-07-24 08:13:46 +08:00
|
|
|
export const enableSuspenseCallback = false;
|
2019-07-26 06:44:03 +08:00
|
|
|
|
|
|
|
|
// Part of the simplification of React.createElement so we can eventually move
|
|
|
|
|
// from React.createElement to React.jsx
|
|
|
|
|
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
|
|
|
export const warnAboutDefaultPropsOnFunctionComponents = false;
|
2019-08-03 08:52:32 +08:00
|
|
|
|
|
|
|
|
export const disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
2019-09-16 20:43:22 +08:00
|
|
|
|
2020-01-22 11:43:35 +08:00
|
|
|
export const enableTrainModelFix = true;
|
2019-12-04 05:38:02 +08:00
|
|
|
|
2019-09-16 20:43:22 +08:00
|
|
|
export const enableTrustedTypesIntegration = false;
|
2019-11-12 03:35:29 +08:00
|
|
|
|
|
|
|
|
// Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
|
|
|
|
|
export const enableNativeTargetAsInstance = false;
|
2020-01-20 23:00:18 +08:00
|
|
|
|
|
|
|
|
// --------------------------
|
|
|
|
|
// Future APIs to be deprecated
|
|
|
|
|
// --------------------------
|
|
|
|
|
|
|
|
|
|
// Prevent the value and checked attributes from syncing
|
|
|
|
|
// with their related DOM properties
|
|
|
|
|
export const disableInputAttributeSyncing = false;
|
|
|
|
|
|
|
|
|
|
export const warnAboutStringRefs = false;
|
|
|
|
|
|
|
|
|
|
export const disableLegacyContext = false;
|
|
|
|
|
|
|
|
|
|
// Disables React.createFactory
|
|
|
|
|
export const disableCreateFactory = false;
|
2020-01-20 23:12:30 +08:00
|
|
|
|
|
|
|
|
// Disables children for <textarea> elements
|
|
|
|
|
export const disableTextareaChildren = false;
|
2020-01-22 05:17:42 +08:00
|
|
|
|
|
|
|
|
// Disables ReactDOM.unstable_renderSubtreeIntoContainer
|
|
|
|
|
export const disableUnstableRenderSubtreeIntoContainer = false;
|
|
|
|
|
|
|
|
|
|
// Disables ReactDOM.unstable_createPortal
|
|
|
|
|
export const disableUnstableCreatePortal = false;
|