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

Re-enable fragment export #11672

Merged
merged 1 commit into from
Nov 27, 2017
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import typeof * as CSFeatureFlagsType from './ReactNativeCSFeatureFlags';
export const debugRenderPhaseSideEffects = false;
export const enableAsyncSubtreeAPI = true;
export const enableAsyncSchedulingByDefaultInReactDOM = false;
export const enableReactFragment = false;
export const enableCreateRoot = false;
export const enableUserTimingAPI = __DEV__;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ let ReactDOMServer;
function initModules() {
// Reset warning cache.
jest.resetModuleRegistry();
require('shared/ReactFeatureFlags').enableReactFragment = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you removed the last internal import in this file, we should also remove .internal.js prefix. Then tests will run in production env too :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React = require('react');
ReactDOM = require('react-dom');
ReactDOMServer = require('react-dom/server');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const {debugRenderPhaseSideEffects} = require('ReactFeatureFlags');
// The rest of the flags are static for better dead code elimination.
export const enableAsyncSubtreeAPI = true;
export const enableAsyncSchedulingByDefaultInReactDOM = false;
export const enableReactFragment = false;
export const enableCreateRoot = false;
export const enableUserTimingAPI = __DEV__;
export const enableMutatingReconciler = true;
Expand Down
2 changes: 0 additions & 2 deletions packages/react-reconciler/src/ReactChildFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import type {ReactCall, ReactPortal, ReactReturn} from 'shared/ReactTypes';
import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {ExpirationTime} from 'react-reconciler/src/ReactFiberExpirationTime';

import {enableReactFragment} from 'shared/ReactFeatureFlags';
import {Placement, Deletion} from 'shared/ReactTypeOfSideEffect';
import {
getIteratorFn,
Expand Down Expand Up @@ -1376,7 +1375,6 @@ function ChildReconciler(shouldTrackSideEffects) {
// This leads to an ambiguity between <>{[...]}</> and <>...</>.
// We treat the ambiguous cases above the same.
if (
enableReactFragment &&
typeof newChild === 'object' &&
newChild !== null &&
newChild.type === REACT_FRAGMENT_TYPE &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ describe('ReactFragment', () => {
beforeEach(function() {
jest.resetModules();

const ReactFeatureFlags = require('shared/ReactFeatureFlags');
ReactFeatureFlags.enableReactFragment = true;

React = require('react');
ReactNoop = require('react-noop-renderer');
});
Expand Down
7 changes: 2 additions & 5 deletions packages/react/src/React.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import assign from 'object-assign';
import ReactVersion from 'shared/ReactVersion';
import {enableReactFragment} from 'shared/ReactFeatureFlags';
import {REACT_FRAGMENT_TYPE} from 'shared/ReactSymbols';

import {Component, PureComponent, AsyncComponent} from './ReactBaseClasses';
Expand Down Expand Up @@ -39,6 +38,8 @@ var React = {
PureComponent,
unstable_AsyncComponent: AsyncComponent,

Fragment: REACT_FRAGMENT_TYPE,

createElement: __DEV__ ? createElementWithValidation : createElement,
cloneElement: __DEV__ ? cloneElementWithValidation : cloneElement,
createFactory: __DEV__ ? createFactoryWithValidation : createFactory,
Expand All @@ -53,10 +54,6 @@ var React = {
},
};

if (enableReactFragment) {
React.Fragment = REACT_FRAGMENT_TYPE;
}

if (__DEV__) {
Object.assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
// These should not be included in production.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ describe('ReactJSXElementValidator', () => {
beforeEach(() => {
jest.resetModules();

const ReactFeatureFlags = require('shared/ReactFeatureFlags');
ReactFeatureFlags.enableReactFragment = true;

React = require('react');
ReactTestUtils = require('react-dom/test-utils');
});
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import invariant from 'fbjs/lib/invariant';

export const enableAsyncSubtreeAPI = true;
export const enableAsyncSchedulingByDefaultInReactDOM = false;
// Exports React.Fragment
export const enableReactFragment = false;
// Exports ReactDOM.createRoot
export const enableCreateRoot = false;
export const enableUserTimingAPI = __DEV__;
Expand Down
1 change: 0 additions & 1 deletion scripts/rollup/shims/rollup/ReactFeatureFlags-www.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const {

// The rest of the flags are static for better dead code elimination.
export const enableAsyncSubtreeAPI = true;
export const enableReactFragment = false;
export const enableCreateRoot = true;

// The www bundles only use the mutating reconciler.
Expand Down