Skip to content

Commit

Permalink
Merge branch 'main' into rh/empty-string
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Dec 15, 2024
2 parents 3ed3bd2 + e06c72f commit 3012d8b
Show file tree
Hide file tree
Showing 44 changed files with 399 additions and 1,390 deletions.
15 changes: 5 additions & 10 deletions packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ describe('ReactCompositeComponent', () => {
});

it('should cleanup even if render() fatals', async () => {
const dispatcherEnabled = __DEV__ || gate(flags => flags.enableCache);
const ownerEnabled = __DEV__;

let stashedDispatcher;
Expand All @@ -551,7 +550,7 @@ describe('ReactCompositeComponent', () => {
}

const instance = <BadComponent />;
expect(ReactSharedInternals.A).toBe(dispatcherEnabled ? null : undefined);
expect(ReactSharedInternals.A).toBe(null);

const root = ReactDOMClient.createRoot(document.createElement('div'));
await expect(async () => {
Expand All @@ -560,15 +559,11 @@ describe('ReactCompositeComponent', () => {
});
}).rejects.toThrow();

expect(ReactSharedInternals.A).toBe(dispatcherEnabled ? null : undefined);
if (dispatcherEnabled) {
if (ownerEnabled) {
expect(stashedDispatcher.getOwner()).toBe(null);
} else {
expect(stashedDispatcher.getOwner).toBe(undefined);
}
expect(ReactSharedInternals.A).toBe(null);
if (ownerEnabled) {
expect(stashedDispatcher.getOwner()).toBe(null);
} else {
expect(stashedDispatcher).toBe(undefined);
expect(stashedDispatcher.getOwner).toBe(undefined);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,6 @@ describe('ReactDOMServerIntegration', () => {
resetModules();
});

// Test pragmas don't support itRenders abstraction
if (
__EXPERIMENTAL__ &&
require('shared/ReactFeatureFlags').enableDebugTracing
) {
describe('React.unstable_DebugTracingMode', () => {
beforeEach(() => {
spyOnDevAndProd(console, 'log');
});

itRenders('with one child', async render => {
const e = await render(
<React.unstable_DebugTracingMode>
<div>text1</div>
</React.unstable_DebugTracingMode>,
);
const parent = e.parentNode;
expect(parent.childNodes[0].tagName).toBe('DIV');
});

itRenders('mode with several children', async render => {
const Header = props => {
return <p>header</p>;
};
const Footer = props => {
return (
<React.unstable_DebugTracingMode>
<h2>footer</h2>
<h3>about</h3>
</React.unstable_DebugTracingMode>
);
};
const e = await render(
<React.unstable_DebugTracingMode>
<div>text1</div>
<span>text2</span>
<Header />
<Footer />
</React.unstable_DebugTracingMode>,
);
const parent = e.parentNode;
expect(parent.childNodes[0].tagName).toBe('DIV');
expect(parent.childNodes[1].tagName).toBe('SPAN');
expect(parent.childNodes[2].tagName).toBe('P');
expect(parent.childNodes[3].tagName).toBe('H2');
expect(parent.childNodes[4].tagName).toBe('H3');
});
});
}

describe('React.StrictMode', () => {
itRenders('a strict mode with one child', async render => {
const e = await render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ if (!__EXPERIMENTAL__) {
);
});

// @gate enableCache
it('supports cache', async () => {
let counter = 0;
const getCount = React.cache(() => {
Expand Down
231 changes: 0 additions & 231 deletions packages/react-reconciler/src/DebugTracing.js

This file was deleted.

10 changes: 0 additions & 10 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
enableScopeAPI,
enableLegacyHidden,
enableTransitionTracing,
enableDebugTracing,
enableDO_NOT_USE_disableStrictPassiveEffect,
enableRenderableContext,
disableLegacyMode,
Expand Down Expand Up @@ -80,7 +79,6 @@ import {NoLanes} from './ReactFiberLane';
import {
NoMode,
ConcurrentMode,
DebugTracingMode,
ProfileMode,
StrictLegacyMode,
StrictEffectsMode,
Expand All @@ -89,7 +87,6 @@ import {
import {
REACT_FORWARD_REF_TYPE,
REACT_FRAGMENT_TYPE,
REACT_DEBUG_TRACING_MODE_TYPE,
REACT_STRICT_MODE_TYPE,
REACT_PROFILER_TYPE,
REACT_PROVIDER_TYPE,
Expand Down Expand Up @@ -630,13 +627,6 @@ export function createFiberFromTypeAndProps(
return createFiberFromTracingMarker(pendingProps, mode, lanes, key);
}
// Fall through
case REACT_DEBUG_TRACING_MODE_TYPE:
if (enableDebugTracing) {
fiberTag = Mode;
mode |= DebugTracingMode;
break;
}
// Fall through
default: {
if (typeof type === 'object' && type !== null) {
switch (type.$$typeof) {
Expand Down
4 changes: 0 additions & 4 deletions packages/react-reconciler/src/ReactFiberAsyncDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
import type {AsyncDispatcher, Fiber} from './ReactInternalTypes';
import type {Cache} from './ReactFiberCacheComponent';

import {enableCache} from 'shared/ReactFeatureFlags';
import {readContext} from './ReactFiberNewContext';
import {CacheContext} from './ReactFiberCacheComponent';

import {current as currentOwner} from './ReactCurrentFiber';

function getCacheForType<T>(resourceType: () => T): T {
if (!enableCache) {
throw new Error('Not implemented.');
}
const cache: Cache = readContext(CacheContext);
let cacheForType: T | void = (cache.data.get(resourceType): any);
if (cacheForType === undefined) {
Expand Down
Loading

0 comments on commit 3012d8b

Please sign in to comment.