mirror of
https://github.com/facebook/react.git
synced 2026-02-24 20:53:03 +00:00
* Suspending inside a constructor outside of strict mode Outside of strict mode, suspended components commit in an incomplete state, then are synchronously deleted in a subsequent commit. If a component suspends inside the constructor, it mounts without an instance. This breaks at least one invariant: during deletion, we assume that every mounted component has an instance, and check the instance for the existence of `componentWillUnmount`. Rather than add a redundant check to the deletion of every class component, components that suspend inside their constructor and outside of strict mode are turned into empty functional components before they are mounted. This is a bit weird, but it's an edge case, and the empty component will be synchronously unmounted regardless. * Do not fire lifecycles of a suspended component In non-strict mode, suspended components commit, but their lifecycles should not fire.
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
export type TypeOfSideEffect = number;
|
|
|
|
// Don't change these two values. They're used by React Dev Tools.
|
|
export const NoEffect = /* */ 0b00000000000;
|
|
export const PerformedWork = /* */ 0b00000000001;
|
|
|
|
// You can change the rest (and add more).
|
|
export const Placement = /* */ 0b00000000010;
|
|
export const Update = /* */ 0b00000000100;
|
|
export const PlacementAndUpdate = /* */ 0b00000000110;
|
|
export const Deletion = /* */ 0b00000001000;
|
|
export const ContentReset = /* */ 0b00000010000;
|
|
export const Callback = /* */ 0b00000100000;
|
|
export const DidCapture = /* */ 0b00001000000;
|
|
export const Ref = /* */ 0b00010000000;
|
|
export const Snapshot = /* */ 0b00100000000;
|
|
|
|
// Update & Callback & Ref & Snapshot
|
|
export const LifecycleEffectMask = /* */ 0b00110100100;
|
|
|
|
// Union of all host effects
|
|
export const HostEffectMask = /* */ 0b00111111111;
|
|
|
|
export const Incomplete = /* */ 0b01000000000;
|
|
export const ShouldCapture = /* */ 0b10000000000;
|