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

[bug fix] revert values in ReactFiberFlags to keep consistency for devtools #25832

Merged
merged 1 commit into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions packages/react-devtools-shared/src/backend/ReactFiberFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// This list of flags must be synced with the following file:
// https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberFlags.js

export const NoFlags = /* */ 0b00000000000000000000000000;
export const PerformedWork = /* */ 0b00000000000000000000000001;
export const Placement = /* */ 0b00000000000000000000000010;
export const DidCapture = /* */ 0b00000000000000000001000000;
export const Hydrating = /* */ 0b00000000000000100000000000;
export const NoFlags = /* */ 0b000000000000000000000000000;
export const PerformedWork = /* */ 0b000000000000000000000000001;
export const Placement = /* */ 0b000000000000000000000000010;
export const DidCapture = /* */ 0b000000000000000000010000000;
export const Hydrating = /* */ 0b000000000000001000000000000;
60 changes: 33 additions & 27 deletions packages/react-reconciler/src/ReactFiberFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,29 @@ import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';
export type Flags = number;

// Don't change these values. They're used by React Dev Tools.
export const NoFlags = /* */ 0b00000000000000000000000000;
export const PerformedWork = /* */ 0b00000000000000000000000001;
export const Placement = /* */ 0b00000000000000000000000010;
export const DidCapture = /* */ 0b00000000000000000001000000;
export const Hydrating = /* */ 0b00000000000000100000000000;
export const NoFlags = /* */ 0b000000000000000000000000000;
export const PerformedWork = /* */ 0b000000000000000000000000001;
export const Placement = /* */ 0b000000000000000000000000010;
export const DidCapture = /* */ 0b000000000000000000010000000;
export const Hydrating = /* */ 0b000000000000001000000000000;

// You can change the rest (and add more).
export const Update = /* */ 0b00000000000000000000000100;
export const ChildDeletion = /* */ 0b00000000000000000000001000;
export const ContentReset = /* */ 0b00000000000000000000010000;
export const Callback = /* */ 0b00000000000000000000100000;
export const ForceClientRender = /* */ 0b00000000000000000010000000;
export const Ref = /* */ 0b00000000000000000100000000;
export const Snapshot = /* */ 0b00000000000000001000000000;
export const Passive = /* */ 0b00000000000000010000000000;
export const Visibility = /* */ 0b00000000000001000000000000;
export const StoreConsistency = /* */ 0b00000000000010000000000000;
export const Update = /* */ 0b000000000000000000000000100;
/* Skipped value: 0b000000000000000000000001000; */

export const ChildDeletion = /* */ 0b000000000000000000000010000;
export const ContentReset = /* */ 0b000000000000000000000100000;
export const Callback = /* */ 0b000000000000000000001000000;
/* Used by DidCapture: 0b000000000000000000010000000; */

export const ForceClientRender = /* */ 0b000000000000000000100000000;
export const Ref = /* */ 0b000000000000000001000000000;
export const Snapshot = /* */ 0b000000000000000010000000000;
export const Passive = /* */ 0b000000000000000100000000000;
/* Used by Hydrating: 0b000000000000001000000000000; */

export const Visibility = /* */ 0b000000000000010000000000000;
export const StoreConsistency = /* */ 0b000000000000100000000000000;

export const LifecycleEffectMask =
Passive | Update | Callback | Ref | Snapshot | StoreConsistency;
Expand All @@ -37,26 +43,26 @@ export const LifecycleEffectMask =
export const HostEffectMask = /* */ 0b00000000000011111111111111;

// These are not really side effects, but we still reuse this field.
export const Incomplete = /* */ 0b00000000000100000000000000;
export const ShouldCapture = /* */ 0b00000000001000000000000000;
export const ForceUpdateForLegacySuspense = /* */ 0b00000000010000000000000000;
export const DidPropagateContext = /* */ 0b00000000100000000000000000;
export const NeedsPropagation = /* */ 0b00000001000000000000000000;
export const Forked = /* */ 0b00000010000000000000000000;
export const Incomplete = /* */ 0b000000000001000000000000000;
export const ShouldCapture = /* */ 0b000000000010000000000000000;
export const ForceUpdateForLegacySuspense = /* */ 0b000000000100000000000000000;
export const DidPropagateContext = /* */ 0b000000001000000000000000000;
export const NeedsPropagation = /* */ 0b000000010000000000000000000;
export const Forked = /* */ 0b000000100000000000000000000;

// Static tags describe aspects of a fiber that are not specific to a render,
// e.g. a fiber uses a passive effect (even if there are no updates on this particular render).
// This enables us to defer more work in the unmount case,
// since we can defer traversing the tree during layout to look for Passive effects,
// and instead rely on the static flag as a signal that there may be cleanup work.
export const RefStatic = /* */ 0b00000100000000000000000000;
export const LayoutStatic = /* */ 0b00001000000000000000000000;
export const PassiveStatic = /* */ 0b00010000000000000000000000;
export const RefStatic = /* */ 0b000001000000000000000000000;
export const LayoutStatic = /* */ 0b000010000000000000000000000;
export const PassiveStatic = /* */ 0b000100000000000000000000000;

// Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`.
export const PlacementDEV = /* */ 0b00100000000000000000000000;
export const MountLayoutDev = /* */ 0b01000000000000000000000000;
export const MountPassiveDev = /* */ 0b10000000000000000000000000;
export const PlacementDEV = /* */ 0b001000000000000000000000000;
export const MountLayoutDev = /* */ 0b010000000000000000000000000;
export const MountPassiveDev = /* */ 0b100000000000000000000000000;

// Groups of flags that are used in the commit phase to skip over trees that
// don't contain effects, by checking subtreeFlags.
Expand Down